Search in sources :

Example 1 with ParameterizedTypeTree

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

the class Parser method parseTypeArgumentList.

private ParseTree parseTypeArgumentList(SourcePosition start, TypeNameTree typeName) {
    // < TypeArgumentList >
    // TypeArgumentList , TypeArgument
    eat(TokenType.OPEN_ANGLE);
    scanner.incTypeParameterLevel();
    ImmutableList.Builder<ParseTree> typeArguments = ImmutableList.builder();
    ParseTree type = parseType();
    typeArguments.add(type);
    while (peek(TokenType.COMMA)) {
        eat(TokenType.COMMA);
        type = parseType();
        if (type != null) {
            typeArguments.add(type);
        }
    }
    eat(TokenType.CLOSE_ANGLE);
    scanner.decTypeParameterLevel();
    return new ParameterizedTypeTree(getTreeLocation(start), typeName, typeArguments.build());
}
Also used : ParameterizedTypeTree(com.google.javascript.jscomp.parsing.parser.trees.ParameterizedTypeTree) ImmutableList(com.google.common.collect.ImmutableList) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ParameterizedTypeTree (com.google.javascript.jscomp.parsing.parser.trees.ParameterizedTypeTree)1 ParseTree (com.google.javascript.jscomp.parsing.parser.trees.ParseTree)1