use of com.google.javascript.jscomp.parsing.parser.trees.IndexSignatureTree in project closure-compiler by google.
the class Parser method parseIndexSignature.
private IndexSignatureTree parseIndexSignature() {
SourcePosition start = getTreeStartLocation();
eat(TokenType.OPEN_SQUARE);
IdentifierToken name = eatIdOrKeywordAsId();
eat(TokenType.COLON);
// must be 'string' or 'number'
ParseTree indexType = parseTypeName();
eat(TokenType.CLOSE_SQUARE);
eat(TokenType.COLON);
ParseTree declaredType = parseType();
ParseTree nameTree = new MemberVariableTree(getTreeLocation(start), name, false, false, null, indexType);
return new IndexSignatureTree(getTreeLocation(start), nameTree, declaredType);
}
Aggregations