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


Java CallNode.getArgs方法代码示例

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


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

示例1: checkEval

import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
/**
 * Check whether a call node may be a call to eval. In that case we
 * clone the args in order to create the following construct in
 * {@link CodeGenerator}
 *
 * <pre>
 * if (calledFuntion == buildInEval) {
 *    eval(cloned arg);
 * } else {
 *    cloned arg;
 * }
 * </pre>
 *
 * @param callNode call node to check if it's an eval
 */
private CallNode checkEval(final CallNode callNode) {
    if (callNode.getFunction() instanceof IdentNode) {

        final List<Expression> args = callNode.getArgs();
        final IdentNode callee = (IdentNode)callNode.getFunction();

        // 'eval' call with at least one argument
        if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) {
            final List<Expression> evalArgs = new ArrayList<>(args.size());
            for(final Expression arg: args) {
                evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this));
            }
            return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee)));
        }
    }

    return callNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:Lower.java

示例2: checkEval

import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
/**
 * Check whether a call node may be a call to eval. In that case we
 * clone the args in order to create the following construct in
 * {@link CodeGenerator}
 *
 * <pre>
 * if (calledFuntion == buildInEval) {
 *    eval(cloned arg);
 * } else {
 *    cloned arg;
 * }
 * </pre>
 *
 * @param callNode call node to check if it's an eval
 */
private CallNode checkEval(final CallNode callNode) {
    if (callNode.getFunction() instanceof IdentNode) {

        final List<Expression> args = callNode.getArgs();
        final IdentNode callee = (IdentNode)callNode.getFunction();

        // 'eval' call with at least one argument
        if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) {
            final FunctionNode currentFunction = lc.getCurrentFunction();
            return callNode.setEvalArgs(
                new CallNode.EvalArgs(
                    (Expression)ensureUniqueNamesIn(args.get(0)).accept(this),
                    compilerConstant(THIS),
                    evalLocation(callee),
                    currentFunction.isStrict()));
        }
    }

    return callNode;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:36,代码来源:Lower.java

示例3: leaveCallNode

import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
@Override
public Node leaveCallNode(final CallNode callNode) {
    //apply needs to be a global symbol or we don't allow it

    final List<IdentNode> newParams = explodedArguments.peek();
    if (isApply(callNode)) {
        final List<Expression> newArgs = new ArrayList<>();
        for (final Expression arg : callNode.getArgs()) {
            if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) {
                newArgs.addAll(newParams);
            } else {
                newArgs.add(arg);
            }
        }

        changed.add(lc.getCurrentFunction().getId());

        final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall();

        if (log.isEnabled()) {
            log.fine("Transformed ",
                    callNode,
                    " from apply to call => ",
                    newCallNode,
                    " in ",
                    DebugLogger.quote(lc.getCurrentFunction().getName()));
        }

        return newCallNode;
    }

    return callNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:ApplySpecialization.java

示例4: loadNEW

import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
private void loadNEW(final UnaryNode unaryNode) {
    final CallNode callNode = (CallNode)unaryNode.getExpression();
    final List<Expression> args   = callNode.getArgs();

    // Load function reference.
    loadExpressionAsObject(callNode.getFunction()); // must detect type error

    method.dynamicNew(1 + loadArgs(args), getCallSiteFlags());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:CodeGenerator.java

示例5: loadNEW

import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
private void loadNEW(final UnaryNode unaryNode) {
    final CallNode callNode = (CallNode)unaryNode.getExpression();
    final List<Expression> args   = callNode.getArgs();

    final Expression func = callNode.getFunction();
    // Load function reference.
    loadExpressionAsObject(func); // must detect type error

    method.dynamicNew(1 + loadArgs(args), getCallSiteFlags(), func.toString(false));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:CodeGenerator.java

示例6: enterNEW

import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
@Override
public boolean enterNEW(final UnaryNode unaryNode) {
    final CallNode callNode = (CallNode)unaryNode.rhs();
    final List<Expression> args   = callNode.getArgs();

    // Load function reference.
    load(callNode.getFunction(), Type.OBJECT); // must detect type error

    method.dynamicNew(1 + loadArgs(args), getCallSiteFlags());
    method.store(unaryNode.getSymbol());

    return false;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:14,代码来源:CodeGenerator.java

示例7: enterNEW

import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
@Override
public boolean enterNEW(final UnaryNode unaryNode) {
    final CallNode callNode = (CallNode)unaryNode.rhs();
    final List<Expression> args   = callNode.getArgs();

    // Load function reference.
    load(callNode.getFunction()).convert(Type.OBJECT); // must detect type error

    method.dynamicNew(1 + loadArgs(args), getCallSiteFlags());
    method.store(unaryNode.getSymbol());

    return false;
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:14,代码来源:CodeGenerator.java


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