/** * Creates an interface function type. * * @param name the function's name * @param source the node defining this function. Its type ({@link Node#getToken()}) must be * {@link Token#FUNCTION}. * @param templateKeys the templatized types for the interface. */ public FunctionType createInterfaceType( String name, Node source, ImmutableList<TemplateType> templateKeys, boolean struct) { FunctionType fn = new FunctionBuilder(this) .forInterface() .withName(name) .withSourceNode(source) .withEmptyParams() .withTemplateKeys(templateKeys) .build(); if (struct) { fn.setStruct(); } return fn; }
/** Create a new constructor with the parameters and return type stripped. */ public final FunctionType forgetParameterAndReturnTypes() { FunctionType result = new FunctionBuilder(registry) .withName(getReferenceName()) .withSourceNode(source) .withTypeOfThis(getInstanceType()) .withKind(kind) .build(); result.setPrototypeBasedOn(getInstanceType()); return result; }
.forConstructor() .withName(name) .withSourceNode(source) .withParamsNode(parameters) .withReturnType(returnType)
new FunctionBuilder(typeRegistry) .withName(fnName) .withSourceNode(contents.getSourceNode()) .withParamsNode(parametersNode) .withReturnType(returnType, returnTypeInferred)
fnType = new FunctionBuilder(typeRegistry) .withName(fnName) .withSourceNode(contents.getSourceNode()) .withParamsNode(parametersNode) .withReturnType(returnType, returnTypeInferred)
.forConstructor() .withName(fnName) .withSourceNode(contents.getSourceNode()) .withParamsNode(parametersNode) .withReturnType(returnType)
functionBuilder .withName("") .withSourceNode(iife) .withParamsNode(compiler.getTypeRegistry().createParameters(objectTypes)) .withReturnType(function.getJSType());