当前位置: 首页>>代码示例>>Java>>正文


Java PropertyKey.getPropertyName方法代码示例

本文整理汇总了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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:Parser.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:Parser.java

示例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);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:71,代码来源:Parser.java

示例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);
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:71,代码来源:Parser.java


注:本文中的jdk.nashorn.internal.ir.PropertyKey.getPropertyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。