private bool Equals(TypeDeclarationKey other) { return(type == other.type && notNull == other.notNull && canBeNull == other.canBeNull && itemNotNull == other.itemNotNull && itemCanBeNull == other.itemCanBeNull && required == other.required); }
private ITypeBuildingContext ResolveType([NotNull] Type type, [CanBeNull] ICustomAttributeProvider customAttributeProvider) { var typeDeclarationKey = new TypeDeclarationKey(type, customAttributeProvider); if (typeDeclarations.ContainsKey(typeDeclarationKey)) { return(typeDeclarations[typeDeclarationKey]); } var typeLocation = customTypeGenerator.GetTypeLocation(type); var typeBuildingContext = customTypeGenerator.ResolveType(typeLocation, type, typeUnitFactory) ?? GetTypeBuildingContext(typeLocation, type, customAttributeProvider); typeDeclarations.Add(typeDeclarationKey, typeBuildingContext); typeBuildingContext.Initialize(this); return(typeBuildingContext); }
private TypeScriptType GetTypeScriptType([NotNull] TypeScriptUnit targetUnit, [NotNull] Type type, [CanBeNull] ICustomAttributeProvider customAttributeProvider) { customAttributeProvider = ArrayTypeBuildingContext.Accept(type) ? customAttributeProvider : null; var typeDeclarationKey = new TypeDeclarationKey(type, customAttributeProvider); if (typeDeclarations.ContainsKey(typeDeclarationKey)) { return(typeDeclarations[typeDeclarationKey].ReferenceFrom(targetUnit, this)); } if (type.IsGenericTypeDefinition && type.GetGenericTypeDefinition() == typeof(Nullable <>)) { return(new TypeScriptNullableType(GetTypeScriptType(targetUnit, type.GetGenericArguments()[0], null))); } var context = ResolveType(type, customAttributeProvider); return(context.ReferenceFrom(targetUnit, this)); }