Exemplo n.º 1
0
        public override TypeReference Clone()
        {
            InnerClassTypeReference c = new InnerClassTypeReference(baseType.Clone(), Type, new List <TypeReference>());

            CopyFields(this, c);
            return(c);
        }
 public void InnerClassTypeReferencTest()
 {
     InnerClassTypeReference ictr = new InnerClassTypeReference(
         new TypeReference("OuterClass", new List<TypeReference> { new TypeReference("String") }),
         "InnerClass",
         new List<TypeReference> { new TypeReference("Int32"), new TypeReference("Int64") });
     Assert.AreEqual("OuterClass<String>+InnerClass<Int32,Int64>", ictr.ToString());
     CodeTypeOfExpression result = (CodeTypeOfExpression)new TypeOfExpression(ictr).AcceptVisitor(new CodeDomVisitor(), null);
     Assert.AreEqual("OuterClass`1+InnerClass`2", result.Type.BaseType);
     Assert.AreEqual(3, result.Type.TypeArguments.Count);
 }
 public override sealed object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
 {
     this.BeginVisit(innerClassTypeReference);
     object result = this.TrackedVisitInnerClassTypeReference(innerClassTypeReference, data);
     this.EndVisit(innerClassTypeReference);
     return result;
 }
 public virtual object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
 {
     return base.VisitInnerClassTypeReference(innerClassTypeReference, data);
 }
Exemplo n.º 5
0
 public override TypeReference Clone()
 {
     InnerClassTypeReference c = new InnerClassTypeReference(baseType.Clone(), Type, new List<TypeReference>());
     CopyFields(this, c);
     return c;
 }
Exemplo n.º 6
0
 public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
 {
     Debug.Assert((innerClassTypeReference != null));
     Debug.Assert((innerClassTypeReference.GenericTypes != null));
     Debug.Assert((innerClassTypeReference.BaseType != null));
     foreach (TypeReference o in innerClassTypeReference.GenericTypes) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     return innerClassTypeReference.BaseType.AcceptVisitor(this, data);
 }
 public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
 {
     throw new global::System.NotImplementedException("InnerClassTypeReference");
 }
Exemplo n.º 8
0
        void NonArrayTypeName(out TypeReference typeref, bool canBeUnbound)
        {
            string name;
            typeref = null;
            bool isGlobal = false;

            if (StartOf(12)) {
            if (la.kind == 130) {
                Get();
                Expect(26);
                isGlobal = true;
            }
            QualIdentAndTypeArguments(out typeref, canBeUnbound);
            typeref.IsGlobal = isGlobal;
            while (la.kind == 26) {
                Get();
                TypeReference nestedTypeRef;
                QualIdentAndTypeArguments(out nestedTypeRef, canBeUnbound);
                typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes);
            }
            } else if (la.kind == 168) {
            Get();
            typeref = new TypeReference("System.Object", true);
            if (la.kind == 33) {
                Get();
                List<TypeReference> typeArguments = new List<TypeReference>(1);
                  	if (typeref != null) typeArguments.Add(typeref);
                    typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };

            }
            } else if (StartOf(13)) {
            PrimitiveTypeName(out name);
            typeref = new TypeReference(name, true);
            if (la.kind == 33) {
                Get();
                List<TypeReference> typeArguments = new List<TypeReference>(1);
                  	if (typeref != null) typeArguments.Add(typeref);
                    typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };

            }
            } else SynErr(255);
        }
 public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
 {
     Debug.Assert((innerClassTypeReference != null));
     Debug.Assert((innerClassTypeReference.GenericTypes != null));
     Debug.Assert((innerClassTypeReference.BaseType != null));
     for (int i = 0; i < innerClassTypeReference.GenericTypes.Count; i++) {
         TypeReference o = innerClassTypeReference.GenericTypes[i];
         Debug.Assert(o != null);
         nodeStack.Push(o);
         o.AcceptVisitor(this, data);
         o = (TypeReference)nodeStack.Pop();
         if (o == null)
             innerClassTypeReference.GenericTypes.RemoveAt(i--);
         else
             innerClassTypeReference.GenericTypes[i] = o;
     }
     nodeStack.Push(innerClassTypeReference.BaseType);
     innerClassTypeReference.BaseType.AcceptVisitor(this, data);
     innerClassTypeReference.BaseType = ((TypeReference)(nodeStack.Pop()));
     return null;
 }