Search in sources :

Example 1 with ComputedPropertySetterTree

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

the class Parser method parseSetAccessor.

private ParseTree parseSetAccessor(PartialClassElement partial) {
    eatPredefinedString(PredefinedName.SET);
    if (peekPropertyName(0)) {
        Token propertyName = eatObjectLiteralPropertyName();
        FormalParameterListTree parameter = parseSetterParameterList();
        BlockTree body = parseFunctionBody();
        recordFeatureUsed(Feature.SETTER);
        return new SetAccessorTree(getTreeLocation(partial.start), propertyName, partial.isStatic, parameter, body);
    } else {
        ParseTree property = parseComputedPropertyName();
        FormalParameterListTree parameter = parseSetterParameterList();
        BlockTree body = parseFunctionBody();
        recordFeatureUsed(Feature.SETTER);
        return new ComputedPropertySetterTree(getTreeLocation(partial.start), property, partial.isStatic, parameter, body);
    }
}
Also used : SetAccessorTree(com.google.javascript.jscomp.parsing.parser.trees.SetAccessorTree) BlockTree(com.google.javascript.jscomp.parsing.parser.trees.BlockTree) FormalParameterListTree(com.google.javascript.jscomp.parsing.parser.trees.FormalParameterListTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree) ComputedPropertySetterTree(com.google.javascript.jscomp.parsing.parser.trees.ComputedPropertySetterTree)

Aggregations

BlockTree (com.google.javascript.jscomp.parsing.parser.trees.BlockTree)1 ComputedPropertySetterTree (com.google.javascript.jscomp.parsing.parser.trees.ComputedPropertySetterTree)1 FormalParameterListTree (com.google.javascript.jscomp.parsing.parser.trees.FormalParameterListTree)1 ParseTree (com.google.javascript.jscomp.parsing.parser.trees.ParseTree)1 SetAccessorTree (com.google.javascript.jscomp.parsing.parser.trees.SetAccessorTree)1