Java Code Examples for jdk.nashorn.internal.ir.PropertyKey#getPropertyName()
The following examples show how to use
jdk.nashorn.internal.ir.PropertyKey#getPropertyName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Parser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example 2
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example 3
Source File: Parser.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example 4
Source File: Parser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example 5
Source File: Parser.java From hottub with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example 6
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example 7
Source File: Parser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example 8
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example 9
Source File: Parser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example 10
Source File: Parser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example 11
Source File: Parser.java From hottub with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example 12
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example 13
Source File: Parser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * PropertyAssignment : * PropertyName : AssignmentExpression * get PropertyName ( ) { FunctionBody } * set PropertyName ( PropertySetParameterList ) { FunctionBody } * * PropertySetParameterList : * Identifier * * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * Parse an object literal property. * @return Property or reference node. */ private PropertyNode propertyAssignment() { // Capture firstToken. final long propertyToken = token; FunctionNode functionNode; PropertyKey propertyName; if (type == IDENT) { // Get IDENT. final String ident = (String)expectValue(IDENT); if (type != COLON) { final long getSetToken = propertyToken; switch (ident) { case "get": final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER); return new PropertyNode(propertyToken, finish, getIdent, null, functionNode, null); case "set": final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); final IdentNode argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); expect(RPAREN); List<IdentNode> parameters = new ArrayList<>(); parameters.add(argIdent); functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER); return new PropertyNode(propertyToken, finish, setIdent, null, null, functionNode); default: break; } } propertyName = new IdentNode(propertyToken, finish, ident).setIsPropertyName(); } else { propertyName = propertyName(); } expect(COLON); return new PropertyNode(propertyToken, finish, propertyName, assignmentExpression(false), null, null); }
Example 14
Source File: Parser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * PropertyAssignment : * PropertyName : AssignmentExpression * get PropertyName ( ) { FunctionBody } * set PropertyName ( PropertySetParameterList ) { FunctionBody } * * PropertySetParameterList : * Identifier * * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * Parse an object literal property. * @return Property or reference node. */ private PropertyNode propertyAssignment() { // Capture firstToken. final long propertyToken = token; FunctionNode functionNode; PropertyKey propertyName; if (type == IDENT) { // Get IDENT. final String ident = (String)expectValue(IDENT); if (type != COLON) { final long getSetToken = propertyToken; switch (ident) { case "get": final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER); return new PropertyNode(propertyToken, finish, getIdent, null, functionNode, null); case "set": final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); final IdentNode argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); expect(RPAREN); List<IdentNode> parameters = new ArrayList<>(); parameters.add(argIdent); functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER); return new PropertyNode(propertyToken, finish, setIdent, null, null, functionNode); default: break; } } propertyName = new IdentNode(propertyToken, finish, ident).setIsPropertyName(); } else { propertyName = propertyName(); } expect(COLON); return new PropertyNode(propertyToken, finish, propertyName, assignmentExpression(false), null, null); }
Example 15
Source File: Parser.java From nashorn with GNU General Public License v2.0 | 4 votes |
/** * PropertyAssignment : * PropertyName : AssignmentExpression * get PropertyName ( ) { FunctionBody } * set PropertyName ( PropertySetParameterList ) { FunctionBody } * * PropertySetParameterList : * Identifier * * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * Parse an object literal property. * @return Property or reference node. */ private PropertyNode propertyAssignment() { // Capture firstToken. final long propertyToken = token; FunctionNode functionNode; PropertyKey propertyName; if (type == IDENT) { // Get IDENT. final String ident = (String)expectValue(IDENT); if (type != COLON) { final long getSetToken = token; switch (ident) { case "get": final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, "get " + NameCodec.encode(getterName)); expect(LPAREN); expect(RPAREN); functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER); return new PropertyNode(propertyToken, finish, getIdent, null, functionNode, null); case "set": final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, "set " + NameCodec.encode(setterName)); expect(LPAREN); final IdentNode argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); expect(RPAREN); List<IdentNode> parameters = new ArrayList<>(); parameters.add(argIdent); functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER); return new PropertyNode(propertyToken, finish, setIdent, null, null, functionNode); default: break; } } propertyName = new IdentNode(propertyToken, finish, ident).setIsPropertyName(); } else { propertyName = propertyName(); } expect(COLON); return new PropertyNode(propertyToken, finish, propertyName, assignmentExpression(false), null, null); }