Search in sources :

Example 1 with ComputedPropertyFieldTree

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

the class Parser method parseFieldDefinition.

private ParseTree parseFieldDefinition(PartialClassElement partial) {
    ParseTree initializer = null;
    if (peek(TokenType.EQUAL)) {
        initializer = parseInitializer(Expression.NORMAL);
    }
    eatPossiblyImplicitSemiColon();
    if (partial.getName() != null) {
        checkState(partial.getNameExpr() == null);
        return new FieldDeclarationTree(getTreeLocation(partial.start), partial.getName(), partial.isStatic, initializer);
    } else {
        return new ComputedPropertyFieldTree(getTreeLocation(partial.start), partial.getNameExpr(), partial.isStatic, initializer);
    }
}
Also used : FieldDeclarationTree(com.google.javascript.jscomp.parsing.parser.trees.FieldDeclarationTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree) ComputedPropertyFieldTree(com.google.javascript.jscomp.parsing.parser.trees.ComputedPropertyFieldTree)

Aggregations

ComputedPropertyFieldTree (com.google.javascript.jscomp.parsing.parser.trees.ComputedPropertyFieldTree)1 FieldDeclarationTree (com.google.javascript.jscomp.parsing.parser.trees.FieldDeclarationTree)1 ParseTree (com.google.javascript.jscomp.parsing.parser.trees.ParseTree)1