本文整理汇总了Java中jdk.nashorn.internal.ir.PropertyKey.getPropertyName方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyKey.getPropertyName方法的具体用法?Java PropertyKey.getPropertyName怎么用?Java PropertyKey.getPropertyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.ir.PropertyKey
的用法示例。
在下文中一共展示了PropertyKey.getPropertyName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertySetterFunction
import jdk.nashorn.internal.ir.PropertyKey; //导入方法依赖的package包/类
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);
}
示例2: propertyGetterFunction
import jdk.nashorn.internal.ir.PropertyKey; //导入方法依赖的package包/类
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);
}
示例3: propertyAssignment
import jdk.nashorn.internal.ir.PropertyKey; //导入方法依赖的package包/类
/**
* 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);
}
示例4: propertyAssignment
import jdk.nashorn.internal.ir.PropertyKey; //导入方法依赖的package包/类
/**
* 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);
}