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


Java RuntimeNode类代码示例

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


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

示例1: enterExpressionStatement

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
    // handle debugger statement
    final Node expression = expressionStatement.getExpression();
    if (expression instanceof RuntimeNode) {
        expression.accept(this);
        return false;
    }

    enterDefault(expressionStatement);

    type("ExpressionStatement");
    comma();

    property("expression");
    expression.accept(this);

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

示例2: leaveTYPEOF

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
private Node leaveTYPEOF(final UnaryNode unaryNode) {
    final Expression rhs = unaryNode.getExpression();

    final List<Expression> args = new ArrayList<>();
    if (rhs instanceof IdentNode && !isParamOrVar((IdentNode)rhs)) {
        args.add(compilerConstantIdentifier(SCOPE));
        args.add((Expression)LiteralNode.newInstance(rhs, ((IdentNode)rhs).getName()).accept(this)); //null
    } else {
        args.add(rhs);
        args.add((Expression)LiteralNode.newInstance(unaryNode).accept(this)); //null, do not reuse token of identifier rhs, it can be e.g. 'this'
    }

    final Node runtimeNode = new RuntimeNode(unaryNode, Request.TYPEOF, args).accept(this);

    end(unaryNode);

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

示例3: leaveTYPEOF

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
private Node leaveTYPEOF(final UnaryNode unaryNode) {
    final Expression rhs = unaryNode.getExpression();

    final List<Expression> args = new ArrayList<>();
    if (rhs instanceof IdentNode && !isParamOrVar((IdentNode)rhs)) {
        args.add(compilerConstantIdentifier(SCOPE));
        args.add(LiteralNode.newInstance(rhs, ((IdentNode)rhs).getName())); //null
    } else {
        args.add(rhs);
        args.add(LiteralNode.newInstance(unaryNode)); //null, do not reuse token of identifier rhs, it can be e.g. 'this'
    }

    final Node runtimeNode = new RuntimeNode(unaryNode, Request.TYPEOF, args);

    end(unaryNode);

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

示例4: leaveADD

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
/**
 * Add is a special binary, as it works not only on arithmetic, but for
 * strings etc as well.
 */
@Override
public Expression leaveADD(final BinaryNode binaryNode) {
    final Expression lhs = binaryNode.lhs();
    final Expression rhs = binaryNode.rhs();

    final Type type = binaryNode.getType();

    if (type.isObject()) {
        if (!isAddString(binaryNode)) {
            return new RuntimeNode(binaryNode, Request.ADD);
        }
    }

    return binaryNode.setLHS(convert(lhs, type)).setRHS(convert(rhs, type));
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:20,代码来源:FinalizeTypes.java

示例5: debuggerStatement

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
/**
 * DebuggerStatement :
 *      debugger ;
 *
 * See 12.15
 *
 * Parse debugger statement.
 */
private void  debuggerStatement() {
    // Capture DEBUGGER token.
    final int  debuggerLine  = line;
    final long debuggerToken = token;
    // DEBUGGER tested in caller.
    next();
    endOfLine();
    appendStatement(new ExpressionStatement(debuggerLine, debuggerToken, finish, new RuntimeNode(debuggerToken, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Expression>())));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Parser.java

示例6: referenceError

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
private RuntimeNode referenceError(final Expression lhs, final Expression rhs, final boolean earlyError) {
    if (earlyError) {
        throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
    }
    final ArrayList<Expression> args = new ArrayList<>();
    args.add(lhs);
    if (rhs == null) {
        args.add(LiteralNode.newInstance(lhs.getToken(), lhs.getFinish()));
    } else {
        args.add(rhs);
    }
    args.add(LiteralNode.newInstance(lhs.getToken(), lhs.getFinish(), lhs.toString()));
    return new RuntimeNode(lhs.getToken(), lhs.getFinish(), RuntimeNode.Request.REFERENCE_ERROR, args);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Parser.java

示例7: enterRuntimeNode

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
@Override
public boolean enterRuntimeNode(final RuntimeNode runtimeNode) {
    final RuntimeNode.Request req = runtimeNode.getRequest();

    if (req == RuntimeNode.Request.DEBUGGER) {
        enterDefault(runtimeNode);
        type("DebuggerStatement");
        return leave();
    }

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

示例8: dynamicRuntimeCall

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
/**
 * Generate a dynamic call for a runtime node
 *
 * @param name       tag for the invoke dynamic for this runtime node
 * @param returnType return type
 * @param request    RuntimeNode request
 *
 * @return the method emitter
 */
MethodEmitter dynamicRuntimeCall(final String name, final Type returnType, final RuntimeNode.Request request) {
    debug("dynamic_runtime_call", name, "args=", request.getArity(), "returnType=", returnType);
    final String signature = getDynamicSignature(returnType, request.getArity());
    debug("   signature", signature);
    method.visitInvokeDynamicInsn(name, signature, RUNTIMEBOOTSTRAP);
    pushType(returnType);

    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:MethodEmitter.java

示例9: leaveRuntimeNode

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
@Override
public Node leaveRuntimeNode(final RuntimeNode runtimeNode) {
    final Request request = runtimeNode.getRequest();
    final boolean isEqStrict = request == Request.EQ_STRICT;
    if(isEqStrict || request == Request.NE_STRICT) {
        return createIsUndefined(runtimeNode, runtimeNode.getArgs().get(0), runtimeNode.getArgs().get(1),
                isEqStrict ? Request.IS_UNDEFINED : Request.IS_NOT_UNDEFINED);
    }
    return runtimeNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:LocalVariableTypesCalculator.java

示例10: loadRuntimeNode

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
private void loadRuntimeNode(final RuntimeNode runtimeNode) {
    final List<Expression> args = new ArrayList<>(runtimeNode.getArgs());
    if (nullCheck(runtimeNode, args)) {
       return;
    } else if(undefinedCheck(runtimeNode, args)) {
        return;
    }
    // Revert a false undefined check to a strict equality check
    final RuntimeNode newRuntimeNode;
    final Request request = runtimeNode.getRequest();
    if (Request.isUndefinedCheck(request)) {
        newRuntimeNode = runtimeNode.setRequest(request == Request.IS_UNDEFINED ? Request.EQ_STRICT : Request.NE_STRICT);
    } else {
        newRuntimeNode = runtimeNode;
    }

    new OptimisticOperation(newRuntimeNode, TypeBounds.UNBOUNDED) {
        @Override
        void loadStack() {
            for (final Expression arg : args) {
                loadExpression(arg, TypeBounds.OBJECT);
            }
        }
        @Override
        void consumeStack() {
            method.invokestatic(
                    CompilerConstants.className(ScriptRuntime.class),
                    newRuntimeNode.getRequest().toString(),
                    new FunctionSignature(
                        false,
                        false,
                        newRuntimeNode.getType(),
                        args.size()).toString());
        }
    }.emit();

    method.convert(newRuntimeNode.getType());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:CodeGenerator.java

示例11: referenceError

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
private RuntimeNode referenceError(final Expression lhs, final Expression rhs, final boolean earlyError) {
    if (env._parse_only || earlyError) {
        throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
    }
    final ArrayList<Expression> args = new ArrayList<>();
    args.add(lhs);
    if (rhs == null) {
        args.add(LiteralNode.newInstance(lhs.getToken(), lhs.getFinish()));
    } else {
        args.add(rhs);
    }
    args.add(LiteralNode.newInstance(lhs.getToken(), lhs.getFinish(), lhs.toString()));
    return new RuntimeNode(lhs.getToken(), lhs.getFinish(), RuntimeNode.Request.REFERENCE_ERROR, args);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:Parser.java

示例12: enterDebuggerNode

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
@Override
public boolean enterDebuggerNode(final DebuggerNode debuggerNode) {
    final int line = debuggerNode.getLineNumber();
    final long token = debuggerNode.getToken();
    final int finish = debuggerNode.getFinish();
    addStatement(new ExpressionStatement(line, token, finish, new RuntimeNode(token, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Expression>())));
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Lower.java

示例13: loadRuntimeNode

import jdk.nashorn.internal.ir.RuntimeNode; //导入依赖的package包/类
private void loadRuntimeNode(final RuntimeNode runtimeNode) {
    final List<Expression> args = new ArrayList<>(runtimeNode.getArgs());
    if (nullCheck(runtimeNode, args)) {
       return;
    } else if(undefinedCheck(runtimeNode, args)) {
        return;
    }
    // Revert a false undefined check to a strict equality check
    final RuntimeNode newRuntimeNode;
    final Request request = runtimeNode.getRequest();
    if (Request.isUndefinedCheck(request)) {
        newRuntimeNode = runtimeNode.setRequest(request == Request.IS_UNDEFINED ? Request.EQ_STRICT : Request.NE_STRICT);
    } else {
        newRuntimeNode = runtimeNode;
    }

    for (final Expression arg : args) {
        loadExpression(arg, TypeBounds.OBJECT);
    }

    method.invokestatic(
            CompilerConstants.className(ScriptRuntime.class),
            newRuntimeNode.getRequest().toString(),
            new FunctionSignature(
                false,
                false,
                newRuntimeNode.getType(),
                args.size()).toString());

    method.convert(newRuntimeNode.getType());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:CodeGenerator.java


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