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


Java IdentNode.getName方法代码示例

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


在下文中一共展示了IdentNode.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyStrictIdent

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
/**
 * Make sure that in strict mode, the identifier name used is allowed.
 *
 * @param ident         Identifier that is verified
 * @param contextString String used in error message to give context to the user
 */
private void verifyStrictIdent(final IdentNode ident, final String contextString) {
    if (isStrictMode) {
        switch (ident.getName()) {
        case "eval":
        case "arguments":
            throw error(AbstractParser.message("strict.name", ident.getName(), contextString), ident.getToken());
        default:
            break;
        }

        if (ident.isFutureStrictName()) {
            throw error(AbstractParser.message("strict.name", ident.getName(), contextString), ident.getToken());
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Parser.java

示例2: enterCatchNode

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
    final IdentNode exception = catchNode.getException();
    final Block     block     = lc.getCurrentBlock();

    start(catchNode);

    // define block-local exception variable
    final String exname = exception.getName();
    // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its
    // symbol is naturally internal, and should be treated as such.
    final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName());
    // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to
    // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block.
    final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE);
    symbol.clearFlag(IS_LET);

    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:AssignSymbols.java

示例3: verifyParameterList

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
private void verifyParameterList(final List<IdentNode> parameters, final ParserContextFunctionNode functionNode) {
    final IdentNode duplicateParameter = functionNode.getDuplicateParameterBinding();
    if (duplicateParameter != null) {
        if (functionNode.isStrict() || functionNode.getKind() == FunctionNode.Kind.ARROW || !functionNode.isSimpleParameterList()) {
            throw error(AbstractParser.message("strict.param.redefinition", duplicateParameter.getName()), duplicateParameter.getToken());
        }

        final int arity = parameters.size();
        final HashSet<String> parametersSet = new HashSet<>(arity);

        for (int i = arity - 1; i >= 0; i--) {
            final IdentNode parameter = parameters.get(i);
            String parameterName = parameter.getName();

            if (parametersSet.contains(parameterName)) {
                // redefinition of parameter name, rename in non-strict mode
                parameterName = functionNode.uniqueName(parameterName);
                final long parameterToken = parameter.getToken();
                parameters.set(i, new IdentNode(parameterToken, Token.descPosition(parameterToken), functionNode.uniqueName(parameterName)));
            }
            parametersSet.add(parameterName);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:Parser.java

示例4: enterCatchNode

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
    final IdentNode exception = catchNode.getExceptionIdentifier();
    final Block     block     = lc.getCurrentBlock();

    start(catchNode);

    // define block-local exception variable
    final String exname = exception.getName();
    // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its
    // symbol is naturally internal, and should be treated as such.
    final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName());
    // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to
    // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block.
    final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE);
    symbol.clearFlag(IS_LET);

    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AssignSymbols.java

示例5: detectSpecialFunction

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
/**
 * Detect calls to special functions.
 * @param ident Called function.
 */
private void detectSpecialFunction(final IdentNode ident) {
    final String name = ident.getName();

    if (EVAL.symbolName().equals(name)) {
        markEval(lc);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:Parser.java

示例6: enterIdentNode

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
@Override
public boolean enterIdentNode(final IdentNode identNode) {
    enterDefault(identNode);

    final String name = identNode.getName();
    if ("this".equals(name)) {
        type("ThisExpression");
    } else {
        type("Identifier");
        comma();
        property("name", identNode.getName());
    }

    return leave();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:JSONWriter.java

示例7: IdentifierTreeImpl

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
IdentifierTreeImpl(final IdentNode node) {
    super(node);
    this.name = node.getName();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:IdentifierTreeImpl.java


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