• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PropertyKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jdk.nashorn.internal.ir.PropertyKey的典型用法代码示例。如果您正苦于以下问题:Java PropertyKey类的具体用法?Java PropertyKey怎么用?Java PropertyKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyKey类属于jdk.nashorn.internal.ir包,在下文中一共展示了PropertyKey类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: propertyName

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:Parser.java


示例2: 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


示例3: literalPropertyName

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
/**
 * LiteralPropertyName :
 *      IdentifierName
 *      StringLiteral
 *      NumericLiteral
 *
 * @return PropertyName node
 */
@SuppressWarnings("fallthrough")
private PropertyKey literalPropertyName() {
    switch (type) {
    case IDENT:
        return getIdent().setIsPropertyName();
    case OCTAL_LEGACY:
        if (isStrictMode) {
            throw error(AbstractParser.message("strict.no.octal"), token);
        }
    case STRING:
    case ESCSTRING:
    case DECIMAL:
    case HEXADECIMAL:
    case OCTAL:
    case BINARY_NUMBER:
    case FLOATING:
        return getLiteral();
    default:
        return getIdentifierName().setIsPropertyName();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:Parser.java


示例4: 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


示例5: getDefaultFunctionName

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Parser.java


示例6: verifyAllowedMethodName

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
/**
 * ES6 14.5.1 Static Semantics: Early Errors.
 */
private void verifyAllowedMethodName(final Expression key, final boolean isStatic, final boolean computed, final boolean generator, final boolean accessor) {
    if (!computed) {
        if (!isStatic && generator && ((PropertyKey) key).getPropertyName().equals(CONSTRUCTOR_NAME)) {
            throw error(AbstractParser.message("generator.constructor"), key.getToken());
        }
        if (!isStatic && accessor && ((PropertyKey) key).getPropertyName().equals(CONSTRUCTOR_NAME)) {
            throw error(AbstractParser.message("accessor.constructor"), key.getToken());
        }
        if (isStatic && ((PropertyKey) key).getPropertyName().equals("prototype")) {
            throw error(AbstractParser.message("static.prototype.method"), key.getToken());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Parser.java


示例7: propertyGetterFunction

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine, final int flags) {
    final boolean computed = type == LBRACKET;
    final Expression propertyName = propertyName();
    final String getterName = propertyName instanceof PropertyKey ? ((PropertyKey) propertyName).getPropertyName() : getDefaultValidFunctionName(functionLine, false);
    final IdentNode getNameNode = createIdentNode((propertyName).getToken(), finish, NameCodec.encode("get " + getterName));
    expect(LPAREN);
    expect(RPAREN);

    final ParserContextFunctionNode functionNode = createParserContextFunctionNode(getNameNode, getSetToken, FunctionNode.Kind.GETTER, functionLine, Collections.<IdentNode>emptyList());
    functionNode.setFlag(flags);
    if (computed) {
        functionNode.setFlag(FunctionNode.IS_ANONYMOUS);
    }
    lc.push(functionNode);

    Block functionBody;


    try {
        functionBody = functionBody(functionNode);
    } finally {
        lc.pop(functionNode);
    }

    final FunctionNode  function = createFunctionNode(
            functionNode,
            getSetToken,
            getNameNode,
            Collections.<IdentNode>emptyList(),
            FunctionNode.Kind.GETTER,
            functionLine,
            functionBody);

    return new PropertyFunction(propertyName, function, computed);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:Parser.java


示例8: getDefaultFunctionName

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:Parser.java


示例9: verifyAllowedMethodName

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
/**
 * ES6 14.5.1 Static Semantics: Early Errors.
 */
private void verifyAllowedMethodName(final Expression key, final boolean isStatic, final boolean computed, final boolean generator, final boolean accessor) {
    if (!computed) {
        if (!isStatic && generator && ((PropertyKey) key).getPropertyName().equals("constructor")) {
            throw error(AbstractParser.message("generator.constructor"), key.getToken());
        }
        if (!isStatic && accessor && ((PropertyKey) key).getPropertyName().equals("constructor")) {
            throw error(AbstractParser.message("accessor.constructor"), key.getToken());
        }
        if (isStatic && ((PropertyKey) key).getPropertyName().equals("prototype")) {
            throw error(AbstractParser.message("static.prototype.method"), key.getToken());
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:17,代码来源:Parser.java


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


示例11: PropertyFunction

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
PropertyFunction(final PropertyKey ident, final FunctionNode function) {
    this.ident = ident;
    this.functionNode = function;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:Parser.java


示例12: propertySetterFunction

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine, final int flags) {
    final boolean computed = type == LBRACKET;
    final Expression propertyName = propertyName();
    final String setterName = propertyName instanceof PropertyKey ? ((PropertyKey) propertyName).getPropertyName() : getDefaultValidFunctionName(functionLine, false);
    final IdentNode setNameNode = createIdentNode((propertyName).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 (isBindingIdentifier()) {
        argIdent = getIdent();
        verifyIdent(argIdent, "setter argument");
    } else {
        argIdent = null;
    }
    expect(RPAREN);
    final List<IdentNode> parameters = new ArrayList<>();
    if (argIdent != null) {
        parameters.add(argIdent);
    }


    final ParserContextFunctionNode functionNode = createParserContextFunctionNode(setNameNode, getSetToken, FunctionNode.Kind.SETTER, functionLine, parameters);
    functionNode.setFlag(flags);
    if (computed) {
        functionNode.setFlag(FunctionNode.IS_ANONYMOUS);
    }
    lc.push(functionNode);

    Block functionBody;
    try {
        functionBody = functionBody(functionNode);
    } finally {
        lc.pop(functionNode);
    }


    final FunctionNode  function = createFunctionNode(
            functionNode,
            getSetToken,
            setNameNode,
            parameters,
            FunctionNode.Kind.SETTER,
            functionLine,
            functionBody);

    return new PropertyFunction(propertyName, function, computed);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:49,代码来源:Parser.java


示例13: propertyMethodFunction

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
private PropertyFunction propertyMethodFunction(final Expression key, final long methodToken, final int methodLine, final boolean generator, final int flags, final boolean computed) {
    final String methodName = key instanceof PropertyKey ? ((PropertyKey) key).getPropertyName() : getDefaultValidFunctionName(methodLine, false);
    final IdentNode methodNameNode = createIdentNode(((Node)key).getToken(), finish, methodName);

    final FunctionNode.Kind functionKind = generator ? FunctionNode.Kind.GENERATOR : FunctionNode.Kind.NORMAL;
    final ParserContextFunctionNode functionNode = createParserContextFunctionNode(methodNameNode, methodToken, functionKind, methodLine, null);
    functionNode.setFlag(flags);
    if (computed) {
        functionNode.setFlag(FunctionNode.IS_ANONYMOUS);
    }
    lc.push(functionNode);

    try {
        final ParserContextBlockNode parameterBlock = newBlock();
        final List<IdentNode> parameters;
        try {
            expect(LPAREN);
            parameters = formalParameterList(generator);
            functionNode.setParameters(parameters);
            expect(RPAREN);
        } finally {
            restoreBlock(parameterBlock);
        }

        Block functionBody = functionBody(functionNode);

        functionBody = maybeWrapBodyInParameterBlock(functionBody, parameterBlock);

        final FunctionNode  function = createFunctionNode(
                        functionNode,
                        methodToken,
                        methodNameNode,
                        parameters,
                        functionKind,
                        methodLine,
                        functionBody);
        return new PropertyFunction(key, function, computed);
    } finally {
        lc.pop(functionNode);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:Parser.java


示例14: propertyMethodFunction

import jdk.nashorn.internal.ir.PropertyKey; //导入依赖的package包/类
private PropertyFunction propertyMethodFunction(Expression key, final long methodToken, final int methodLine, final boolean generator, final int flags, boolean computed) {
    final String methodName = key instanceof PropertyKey ? ((PropertyKey) key).getPropertyName() : getDefaultValidFunctionName(methodLine, false);
    final IdentNode methodNameNode = createIdentNode(((Node)key).getToken(), finish, methodName);

    FunctionNode.Kind functionKind = generator ? FunctionNode.Kind.GENERATOR : FunctionNode.Kind.NORMAL;
    final ParserContextFunctionNode functionNode = createParserContextFunctionNode(methodNameNode, methodToken, functionKind, methodLine, null);
    functionNode.setFlag(flags);
    if (computed) {
        functionNode.setFlag(FunctionNode.IS_ANONYMOUS);
    }
    lc.push(functionNode);

    try {
        final ParserContextBlockNode parameterBlock = newBlock();
        final List<IdentNode> parameters;
        try {
            expect(LPAREN);
            parameters = formalParameterList(generator);
            functionNode.setParameters(parameters);
            expect(RPAREN);
        } finally {
            restoreBlock(parameterBlock);
        }

        Block functionBody = functionBody(functionNode);

        functionBody = maybeWrapBodyInParameterBlock(functionBody, parameterBlock);

        final FunctionNode  function = createFunctionNode(
                        functionNode,
                        methodToken,
                        methodNameNode,
                        parameters,
                        functionKind,
                        methodLine,
                        functionBody);
        return new PropertyFunction(key, function, computed);
    } finally {
        lc.pop(functionNode);
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:42,代码来源:Parser.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OFMeterConfig类代码示例发布时间:2022-05-22
下一篇:
Java ActivationSigmoid类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap