Пример #1
0
        public static void VisitReference(Microsoft.Cci.IReference reference, Microsoft.CodeAnalysis.Emit.Context context)
        {
            var typeReference = reference as Microsoft.Cci.ITypeReference;

            if (typeReference != null)
            {
                VisitTypeReference(typeReference, context);
                return;
            }

            var methodReference = reference as Microsoft.Cci.IMethodReference;

            if (methodReference != null)
            {
                VisitMethodReference(methodReference, context);
                return;
            }

            var fieldReference = reference as Microsoft.Cci.IFieldReference;

            if (fieldReference != null)
            {
                VisitFieldReference(fieldReference, context);
                return;
            }
        }
Пример #2
0
        public uint GetFakeSymbolTokenForIL(Microsoft.Cci.IReference symbol)
        {
            uint result;

            if (!referencesInILMap.TryGetValue(symbol, out result))
            {
                result = (uint)referencesInIL.Count;
                referencesInILMap.Add(symbol, result);
                referencesInIL.Add(symbol);
            }

            return(result);
        }
Пример #3
0
        internal void EmitToken(Microsoft.Cci.IReference value, SyntaxNode syntaxNode, DiagnosticBag diagnostics)
        {
            uint token = module?.GetFakeSymbolTokenForIL(value, syntaxNode, diagnostics) ?? 0xFFFF;

            this.GetCurrentStream().WriteUint(token);
        }