本文整理汇总了Java中jdk.nashorn.internal.ir.CallNode.getFunction方法的典型用法代码示例。如果您正苦于以下问题:Java CallNode.getFunction方法的具体用法?Java CallNode.getFunction怎么用?Java CallNode.getFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.ir.CallNode
的用法示例。
在下文中一共展示了CallNode.getFunction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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));
}
示例4: leaveCallNode
import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
@Override
public Node leaveCallNode(final CallNode callNode) {
// AccessSpecializer - call return type may change the access for this location
final Node function = callNode.getFunction();
if (function instanceof FunctionNode) {
return setTypeOverride(callNode, ((FunctionNode)function).getReturnType());
}
return callNode;
}
示例5: isApply
import jdk.nashorn.internal.ir.CallNode; //导入方法依赖的package包/类
private static boolean isApply(final CallNode callNode) {
final Expression f = callNode.getFunction();
return f instanceof AccessNode && "apply".equals(((AccessNode)f).getProperty());
}