jdk.nashorn.internal.ir.PropertyKey Java Examples
The following examples show how to use
jdk.nashorn.internal.ir.PropertyKey.
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 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 #2
Source File: Parser.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #3
Source File: Parser.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #4
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 #5
Source File: Parser.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #6
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #7
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 #8
Source File: Parser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #9
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 #10
Source File: Parser.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #11
Source File: Parser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #12
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 #13
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 #14
Source File: Parser.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #15
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * PropertyName : * IdentifierName * StringLiteral * NumericLiteral * * See 11.1.5 * * @return PropertyName node */ @SuppressWarnings("fallthrough") private PropertyKey propertyName() { switch (type) { case IDENT: return getIdent().setIsPropertyName(); case OCTAL: if (isStrictMode) { throw error(AbstractParser.message("strict.no.octal"), token); } case STRING: case ESCSTRING: case DECIMAL: case HEXADECIMAL: case FLOATING: return getLiteral(); default: return getIdentifierName().setIsPropertyName(); } }
Example #16
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 #17
Source File: Parser.java From hottub with GNU General Public License v2.0 | 5 votes |
private String getDefaultFunctionName() { if(!defaultNames.isEmpty()) { final Object nameExpr = defaultNames.peek(); if(nameExpr instanceof PropertyKey) { markDefaultNameUsed(); return ((PropertyKey)nameExpr).getPropertyName(); } else if(nameExpr instanceof AccessNode) { markDefaultNameUsed(); return ((AccessNode)nameExpr).getProperty(); } } return null; }
Example #18
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 #19
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 #20
Source File: Parser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private String getDefaultFunctionName() { if(!defaultNames.isEmpty()) { final Object nameExpr = defaultNames.peek(); if(nameExpr instanceof PropertyKey) { markDefaultNameUsed(); return ((PropertyKey)nameExpr).getPropertyName(); } else if(nameExpr instanceof AccessNode) { markDefaultNameUsed(); return ((AccessNode)nameExpr).getProperty(); } } return null; }
Example #21
Source File: Parser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private String getDefaultFunctionName() { if(!defaultNames.isEmpty()) { final Object nameExpr = defaultNames.peek(); if(nameExpr instanceof PropertyKey) { markDefaultNameUsed(); return ((PropertyKey)nameExpr).getPropertyName(); } else if(nameExpr instanceof AccessNode) { markDefaultNameUsed(); return ((AccessNode)nameExpr).getProperty(); } } return null; }
Example #22
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private String getDefaultFunctionName() { if(!defaultNames.isEmpty()) { final Object nameExpr = defaultNames.peek(); if(nameExpr instanceof PropertyKey) { markDefaultNameUsed(); return ((PropertyKey)nameExpr).getPropertyName(); } else if(nameExpr instanceof AccessNode) { markDefaultNameUsed(); return ((AccessNode)nameExpr).getProperty(); } } return null; }
Example #23
Source File: Parser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private String getDefaultFunctionName() { if(!defaultNames.isEmpty()) { final Object nameExpr = defaultNames.peek(); if(nameExpr instanceof PropertyKey) { markDefaultNameUsed(); return ((PropertyKey)nameExpr).getPropertyName(); } else if(nameExpr instanceof AccessNode) { markDefaultNameUsed(); return ((AccessNode)nameExpr).getProperty(); } } return null; }
Example #24
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 #25
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 #26
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 #27
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private String getDefaultFunctionName() { if(!defaultNames.isEmpty()) { final Object nameExpr = defaultNames.peek(); if(nameExpr instanceof PropertyKey) { markDefaultNameUsed(); return ((PropertyKey)nameExpr).getPropertyName(); } else if(nameExpr instanceof AccessNode) { markDefaultNameUsed(); return ((AccessNode)nameExpr).getProperty(); } } return null; }
Example #28
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
PropertyFunction(final PropertyKey ident, final FunctionNode function) { this.ident = ident; this.functionNode = function; }
Example #29
Source File: Parser.java From jdk8u_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; final int functionLine = line; 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 PropertyFunction getter = propertyGetterFunction(getSetToken, functionLine); return new PropertyNode(propertyToken, finish, getter.ident, null, getter.functionNode, null); case "set": final PropertyFunction setter = propertySetterFunction(getSetToken, functionLine); return new PropertyNode(propertyToken, finish, setter.ident, null, null, setter.functionNode); default: break; } } propertyName = createIdentNode(propertyToken, finish, ident).setIsPropertyName(); } else { propertyName = propertyName(); } expect(COLON); defaultNames.push(propertyName); try { return new PropertyNode(propertyToken, finish, propertyName, assignmentExpression(false), null, null); } finally { defaultNames.pop(); } }
Example #30
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); }