Beispiel #1
0
        public bool ExtraUsedType(QualifiedTypeName name)
        {
            var assemblyDef = default(AssemblyDef);
            var typeDef     = default(TypeDef);

            if (name.PrimTryResolve(Global, out assemblyDef, out typeDef))
            {
                return(typeDef.MarkAsUsed(this, assemblyDef));
            }
            return(false);
        }
Beispiel #2
0
        public bool FirstOccuranceOfType(MessageContext ctxt, CST.QualifiedTypeName name, Trace trace)
        {
            var prev = default(Trace);

            if (TypeToTrace.TryGetValue(name, out prev))
            {
                Env.Log(new DuplicateTraceEntryMessage(ctxt, prev.Name, trace.Name));
                return(false);
            }
            else
            {
                TypeToTrace.Add(name, trace);
                return(true);
            }
        }
Beispiel #3
0
 private PE.Row TypeDefOrRefRowFromQualifiedTypeName(DllSaveContext ctxt, QualifiedTypeName name)
 {
     if (name.Assembly.Equals(ctxt.AssemblyName))
     {
         var assemblyDef = default(AssemblyDef);
         var typeDef     = default(TypeDef);
         if (!name.PrimTryResolve(rootEnv.Global, out assemblyDef, out typeDef))
         {
             throw new InvalidOperationException("no such type");
         }
         return(TypeDefRowFromTypeDef(ctxt, typeDef));
     }
     else
     {
         var row      = default(PE.TypeRefRow);
         var resScope = default(PE.Row);
         if (name.Type.IsNested)
         {
             resScope = TypeDefOrRefRowFromQualifiedTypeName(ctxt, name.Outer());
         }
         else
         {
             resScope = AssemblyNameToAssemblyRefRow(ctxt, name.Assembly);
         }
         if (!ctxt.QualifiedTypeNameToRowCache.TryGetValue(name, out row))
         {
             row = new PE.TypeRefRow
             {
                 ResolutionScope = { Value = resScope },
                 TypeName        = { Value = name.Type.Types[name.Type.Types.Count - 1] },
                 TypeNamespace   = { Value = name.Type.Namespace }
             };
             ctxt.QualifiedTypeNameToRowCache.Add(name, row);
         }
         return(row);
     }
 }
Beispiel #4
0
 public InvalidTypeName(MessageContext ctxt, QualifiedTypeName name, string message)
     : base(ctxt, Severity.Warning, "1020")
 {
     Name    = name;
     Message = message;
 }
Beispiel #5
0
 public NamedTypeRef(QualifiedTypeName name, params TypeRef[] arguments)
     : this(null, name, arguments)
 {
 }
Beispiel #6
0
 public NamedTypeRef(IImSeq <Annotation> annotations, QualifiedTypeName name, params TypeRef[] arguments)
     : base(annotations)
 {
     this.name      = name;
     this.arguments = arguments == null || arguments.Length == 0 ? Constants.EmptyTypeRefs : new Seq <TypeRef>(arguments);
 }
Beispiel #7
0
 public NamedTypeRef(QualifiedTypeName name, IImSeq <TypeRef> arguments)
     : this(null, name, arguments)
 {
 }
Beispiel #8
0
 public NamedTypeRef(IImSeq <Annotation> annotations, QualifiedTypeName name, IImSeq <TypeRef> arguments)
     : base(annotations)
 {
     this.name      = name;
     this.arguments = arguments ?? Constants.EmptyTypeRefs;
 }
Beispiel #9
0
 public static TypeRef Named(QualifiedTypeName name, IImSeq <TypeRef> arguments)
 {
     return(new NamedTypeRef(name, arguments));
 }
Beispiel #10
0
 public static TypeRef Named(QualifiedTypeName name, params TypeRef[] arguments)
 {
     return(new NamedTypeRef(name));
 }
Beispiel #11
0
 public QualifiedMemberName(QualifiedTypeName definingType, Signature signature)
 {
     DefiningType = definingType;
     Signature    = signature;
 }