Exemple #1
0
        protected void Queue(_MemberInfo aItem, object aSrc, string aSrcType, string sourceItem = null)
        {
            if (aItem == null)
            {
                throw new ArgumentNullException(nameof(aItem));
            }

            var xMemInfo = aItem as MemberInfo;

            //TODO: fix this, as each label/symbol should also contain an assembly specifier.

            if (xMemInfo != null && xMemInfo.DeclaringType != null &&
                xMemInfo.DeclaringType.FullName == "System.ThrowHelper" &&
                xMemInfo.DeclaringType.Assembly.GetName().Name != "mscorlib")
            {
                // System.ThrowHelper exists in MS .NET twice...
                // Its an internal class that exists in both mscorlib and system assemblies.
                // They are separate types though, so normally the scanner scans both and
                // then we get conflicting labels. MS included it twice to make exception
                // throwing code smaller. They are internal though, so we cannot
                // reference them directly and only via finding them as they come along.
                // We find it here, not via QueueType so we only check it here. Later
                // we might have to checkin QueueType also.
                // So now we accept both types, but emit code for only one. This works
                // with the current Nasm assembler as we resolve by name in the assembler.
                // However with other assemblers this approach may not work.
                // If AssemblerNASM adds assembly name to the label, this will allow
                // both to exist as they do in BCL.
                // So in the future we might be able to remove this hack, or change
                // how it works.
                //
                // Do nothing
                //
            }
            else if (!mItems.Contains(aItem))
            {
                if (mLogEnabled)
                {
                    LogMapPoint(aSrc, aSrcType, aItem);
                }
                mItems.Add(aItem);
                mItemsList.Add(aItem);

                MethodBase methodBaseSource = aSrc as MethodBase;
                if (methodBaseSource != null)
                {
                    aSrc = methodBaseSource.DeclaringType.ToString() + "::" + aSrc.ToString();
                }

                mQueue.Enqueue(new ScannerQueueItem()
                {
                    Item = aItem, QueueReason = aSrcType, SourceItem = aSrc + Environment.NewLine + sourceItem
                });
            }
        }
Exemple #2
0
        protected void Queue(_MemberInfo aItem, object aSrc, string aSrcType, string sourceItem = null)
        {
            var xMemInfo = aItem as MemberInfo;
            //TODO: fix this, as each label/symbol should also contain an assembly specifier.

            if (xMemInfo != null && xMemInfo.DeclaringType != null
              && xMemInfo.DeclaringType.FullName == "System.ThrowHelper"
              && xMemInfo.DeclaringType.Assembly.GetName().Name != "mscorlib")
            {
                // System.ThrowHelper exists in MS .NET twice...
                // Its an internal class that exists in both mscorlib and system assemblies.
                // They are separate types though, so normally the scanner scans both and
                // then we get conflicting labels. MS included it twice to make exception
                // throwing code smaller. They are internal though, so we cannot
                // reference them directly and only via finding them as they come along.
                // We find it here, not via QueueType so we only check it here. Later
                // we might have to checkin QueueType also.
                // So now we accept both types, but emit code for only one. This works
                // with the current Nasm assembler as we resolve by name in the assembler.
                // However with other assemblers this approach may not work.
                // If AssemblerNASM adds assembly name to the label, this will allow
                // both to exist as they do in BCL.
                // So in the future we might be able to remove this hack, or change
                // how it works.
                //
                // Do nothing
                //
            }
            else if (!mItems.Contains(aItem))
            {
                if (mLogEnabled)
                {
                    LogMapPoint(aSrc, aSrcType, aItem);
                }
                mItems.Add(aItem);
                mItemsList.Add(aItem);

                MethodBase methodBaseSource = aSrc as MethodBase;
                if (methodBaseSource != null)
                {
                    aSrc = methodBaseSource.DeclaringType.ToString() + "::" + aSrc.ToString();
                }

                mQueue.Enqueue(new ScannerQueueItem() { Item = aItem, QueueReason = aSrcType, SourceItem = aSrc + Environment.NewLine + sourceItem });
            }
        }