本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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());
}
示例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));
}
示例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;
}
示例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;
}