Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ctx: CodeGeneratorFileContext,
type: s.Type
): string {
if (!type.isList()) return getJsType(ctx, type, false);
const elementType = type.getList().getElementType();
const elementTypeWhich = elementType.which();
if (elementTypeWhich === s.Type.LIST) {
return `capnp.PointerList(${getConcreteListType(ctx, elementType)})`;
} else if (elementTypeWhich === s.Type.STRUCT) {
const structNode = lookupNode(ctx, elementType.getStruct().getTypeId());
if (
structNode.getStruct().getPreferredListEncoding() !==
s.ElementSize.INLINE_COMPOSITE
) {
throw new Error(E.GEN_FIELD_NON_INLINE_STRUCT_LIST);
}
return `capnp.CompositeList(${getJsType(ctx, elementType, false)})`;
}
return ConcreteListType[elementTypeWhich];
}