public IType VisitChildren(TypeVisitor visitor) { IType g = genericType.AcceptVisitor(visitor); ITypeDefinition def = g as ITypeDefinition; if (def == null) { return(g); } // Keep ta == null as long as no elements changed, allocate the array only if necessary. IType[] ta = (g != genericType) ? new IType[typeArguments.Length] : null; for (int i = 0; i < typeArguments.Length; i++) { IType r = typeArguments[i].AcceptVisitor(visitor); if (r == null) { throw new NullReferenceException("TypeVisitor.Visit-method returned null"); } if (ta == null && r != typeArguments[i]) { // we found a difference, so we need to allocate the array ta = new IType[typeArguments.Length]; for (int j = 0; j < i; j++) { ta[j] = typeArguments[j]; } } if (ta != null) { ta[i] = r; } } if (def == genericType && ta == null) { return(this); } else { return(new ParameterizedType(def, ta ?? typeArguments)); } }
public override IType VisitTypeDefinition(ITypeDefinition type) { return NullableType.Create(compilation, type.AcceptVisitor(typeParameterSubstitution)); }