Search in sources :

Example 1 with FunctionTypeTree

use of com.google.javascript.jscomp.parsing.parser.trees.FunctionTypeTree in project closure-compiler by google.

the class Parser method parseFunctionTypeExpression.

private ParseTree parseFunctionTypeExpression() {
    SourcePosition start = getTreeStartLocation();
    ParseTree typeExpression = null;
    if (peekFunctionTypeExpression()) {
        FormalParameterListTree formalParameterList;
        formalParameterList = parseFormalParameterList(ParamContext.IMPLEMENTATION);
        eat(TokenType.ARROW);
        ParseTree returnType = parseType();
        typeExpression = new FunctionTypeTree(getTreeLocation(start), formalParameterList, returnType);
    } else {
        typeExpression = parseArrayTypeExpression();
    }
    return typeExpression;
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) FunctionTypeTree(com.google.javascript.jscomp.parsing.parser.trees.FunctionTypeTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree) FormalParameterListTree(com.google.javascript.jscomp.parsing.parser.trees.FormalParameterListTree)

Aggregations

FormalParameterListTree (com.google.javascript.jscomp.parsing.parser.trees.FormalParameterListTree)1 FunctionTypeTree (com.google.javascript.jscomp.parsing.parser.trees.FunctionTypeTree)1 ParseTree (com.google.javascript.jscomp.parsing.parser.trees.ParseTree)1 SourcePosition (com.google.javascript.jscomp.parsing.parser.util.SourcePosition)1