Esempio n. 1
0
 MemberReference SymbolToCecil(ISymbol symbol)
 {
     if (symbol is IType type)
     {
         return(typeSystem.GetCecil(type.GetDefinition()));
     }
     else if (symbol is IMember member)
     {
         return(typeSystem.GetCecil(member));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 2
0
        public override void WriteIdentifier(Identifier identifier)
        {
            if (identifier.IsVerbatim || CSharpOutputVisitor.IsKeyword(identifier.Name, identifier))
            {
                output.Write('@');
            }

            var definition = GetCurrentDefinition();

            if (definition != null)
            {
                output.WriteDefinition(identifier.Name, definition, false);
                return;
            }

            var member = GetCurrentMemberReference();

            if (member != null)
            {
                MemberReference cecil;
                if (member is IType type)
                {
                    cecil = typeSystem.GetCecil(type.GetDefinition());
                }
                else if (member is IMember)
                {
                    cecil = typeSystem.GetCecil((IMember)member);
                }
                else
                {
                    cecil = null;
                }
                if (cecil != null)
                {
                    output.WriteReference(identifier.Name, cecil);
                    return;
                }
            }

            definition = GetCurrentLocalDefinition();
            if (definition != null)
            {
                output.WriteDefinition(identifier.Name, definition);
                return;
            }

            var memberRef = GetCurrentLocalReference();

            if (memberRef != null)
            {
                output.WriteReference(identifier.Name, memberRef, true);
                return;
            }

            if (firstUsingDeclaration)
            {
                output.MarkFoldStart(defaultCollapsed: true);
                firstUsingDeclaration = false;
            }

            output.Write(identifier.Name);
        }
Esempio n. 3
0
 public Mono.Cecil.TypeDefinition GetCecil(ITypeDefinition typeDefinition)
 {
     return(context.GetCecil(typeDefinition));
 }