Make getArrayType take type attributes
This commit is contained in:
Родитель
cb604a40e2
Коммит
2f93024d6b
|
@ -124,7 +124,7 @@ export class TypeReconstituter<TBuilder extends BaseGraphRewriteBuilder> {
|
|||
}
|
||||
|
||||
getArrayType(items: TypeRef): void {
|
||||
this.registerAndAddAttributes(this.builderForNewType().getArrayType(items, this._forwardingRef));
|
||||
this.register(this.builderForNewType().getArrayType(this._typeAttributes, items, this._forwardingRef));
|
||||
}
|
||||
|
||||
setArrayItems(items: TypeRef): void {
|
||||
|
|
|
@ -359,11 +359,11 @@ export class TypeBuilder {
|
|||
return this.addType(forwardingRef, tr => new ArrayType(tr, this.typeGraph, undefined), undefined);
|
||||
}
|
||||
|
||||
getArrayType(items: TypeRef, forwardingRef?: TypeRef): TypeRef {
|
||||
getArrayType(attributes: TypeAttributes, items: TypeRef, forwardingRef?: TypeRef): TypeRef {
|
||||
return this.getOrAddType(
|
||||
() => arrayTypeIdentity(emptyTypeAttributes, items),
|
||||
() => arrayTypeIdentity(attributes, items),
|
||||
tr => new ArrayType(tr, this.typeGraph, items),
|
||||
undefined,
|
||||
attributes,
|
||||
forwardingRef
|
||||
);
|
||||
}
|
||||
|
|
|
@ -160,8 +160,7 @@ export class UnifyUnionBuilder extends UnionBuilder<BaseGraphRewriteBuilder, Typ
|
|||
typeAttributes: TypeAttributes,
|
||||
forwardingRef: TypeRef | undefined
|
||||
): TypeRef {
|
||||
const ref = this.typeBuilder.getArrayType(this._unifyTypes(arrays), forwardingRef);
|
||||
this.typeBuilder.addAttributes(ref, typeAttributes);
|
||||
const ref = this.typeBuilder.getArrayType(typeAttributes, this._unifyTypes(arrays), forwardingRef);
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,10 +53,11 @@ class InferenceUnionBuilder extends UnionBuilder<TypeBuilder, NestedValueArray,
|
|||
|
||||
protected makeArray(
|
||||
arrays: NestedValueArray,
|
||||
_typeAttributes: TypeAttributes,
|
||||
typeAttributes: TypeAttributes,
|
||||
forwardingRef: TypeRef | undefined
|
||||
): TypeRef {
|
||||
return this.typeBuilder.getArrayType(
|
||||
typeAttributes,
|
||||
this._typeInference.inferType(emptyTypeAttributes, arrays, this._fixed, forwardingRef)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -669,7 +669,7 @@ export async function addTypesInSchema(
|
|||
itemType = typeBuilder.getPrimitiveType("any");
|
||||
}
|
||||
typeBuilder.addAttributes(itemType, singularAttributes);
|
||||
return typeBuilder.getArrayType(itemType);
|
||||
return typeBuilder.getArrayType(emptyTypeAttributes, itemType);
|
||||
}
|
||||
|
||||
async function makeObjectType(): Promise<TypeRef> {
|
||||
|
|
|
@ -320,8 +320,7 @@ class IntersectionUnionBuilder extends UnionBuilder<
|
|||
): TypeRef {
|
||||
// FIXME: attributes
|
||||
const itemsType = this.makeIntersection(arrays, emptyTypeAttributes);
|
||||
const tref = this.typeBuilder.getArrayType(itemsType, forwardingRef);
|
||||
this.typeBuilder.addAttributes(tref, typeAttributes);
|
||||
const tref = this.typeBuilder.getArrayType(typeAttributes, itemsType, forwardingRef);
|
||||
return tref;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,6 +239,7 @@ class GQLQuery {
|
|||
return panic("No type for list.");
|
||||
}
|
||||
result = builder.getArrayType(
|
||||
emptyTypeAttributes,
|
||||
this.makeIRTypeFromFieldNode(builder, fieldNode, fieldType.ofType, containingTypeName)
|
||||
);
|
||||
break;
|
||||
|
@ -454,12 +455,11 @@ function makeGraphQLQueryTypes(
|
|||
)
|
||||
})
|
||||
);
|
||||
const errorArray = builder.getArrayType(errorType);
|
||||
builder.addAttributes(
|
||||
errorArray,
|
||||
const errorArray = builder.getArrayType(
|
||||
namesTypeAttributeKind.makeAttributes(
|
||||
TypeNames.make(new Set(["errors"]), new Set(["graphQLErrors"]), false)
|
||||
)
|
||||
),
|
||||
errorType
|
||||
);
|
||||
const t = builder.getClassType(
|
||||
makeNamesTypeAttributes(queryName, false),
|
||||
|
|
Загрузка…
Ссылка в новой задаче