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


Java UnaryNode.getExpression方法代码示例

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


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

示例1: leaveTYPEOF

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的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

示例2: branchOptimizer

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的package包/类
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    final Expression rhs = unaryNode.getExpression();

    switch (unaryNode.tokenType()) {
    case NOT:
        branchOptimizer(rhs, label, !state);
        return;
    default:
        if (unaryNode.getType().isBoolean()) {
            branchOptimizer(rhs, label, state);
            return;
        }
        break;
    }

    loadTestAndJump(unaryNode, label, state);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:BranchOptimizer.java

示例3: loadNOT

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的package包/类
private void loadNOT(final UnaryNode unaryNode) {
    final Expression expr = unaryNode.getExpression();
    if(expr instanceof UnaryNode && expr.isTokenType(TokenType.NOT)) {
        // !!x is idiomatic boolean cast in JavaScript
        loadExpressionAsBoolean(((UnaryNode)expr).getExpression());
    } else {
        final Label trueLabel  = new Label("true");
        final Label afterLabel = new Label("after");

        emitBranch(expr, trueLabel, true);
        method.load(true);
        method._goto(afterLabel);
        method.label(trueLabel);
        method.load(false);
        method.label(afterLabel);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:CodeGenerator.java

示例4: leaveTYPEOF

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的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

示例5: leaveUnaryNode

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的package包/类
@Override
public Node leaveUnaryNode(final UnaryNode unaryNode) {
    if (unaryNode.isAssignment() && unaryNode.getExpression() instanceof IdentNode) {
        checkConstAssignment((IdentNode) unaryNode.getExpression());
    }
    switch (unaryNode.tokenType()) {
    case DELETE:
        return leaveDELETE(unaryNode);
    case TYPEOF:
        return leaveTYPEOF(unaryNode);
    default:
        return super.leaveUnaryNode(unaryNode);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AssignSymbols.java

示例6: enterUnaryNode

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的package包/类
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    final Expression expr = unaryNode.getExpression();
    expr.accept(this);

    if(unaryNode.isSelfModifying()) {
        if(expr instanceof IdentNode) {
            final IdentNode ident = (IdentNode)expr;
            onSelfAssignment(ident, unaryNode, getLocalVariableTypeIfBytecode(ident.getSymbol()));
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:LocalVariableTypesCalculator.java

示例7: loadNEW

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的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

示例8: enterUnaryNode

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的package包/类
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    final Expression expr = unaryNode.getExpression();
    final LvarType unaryType = toLvarType(unaryNode.setExpression(visitExpression(expr).typeExpression).getType());
    if(unaryNode.isSelfModifying() && expr instanceof IdentNode) {
        onSelfAssignment((IdentNode)expr, unaryType);
    }
    typeStack.push(unaryType);
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:LocalVariableTypesCalculator.java

示例9: loadNEW

import jdk.nashorn.internal.ir.UnaryNode; //导入方法依赖的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

示例10: enterUnaryNode

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

    final TokenType tokenType = unaryNode.tokenType();
    if (tokenType == TokenType.NEW) {
        type("NewExpression");
        comma();

        final CallNode callNode = (CallNode)unaryNode.getExpression();
        property("callee");
        callNode.getFunction().accept(this);
        comma();

        array("arguments", callNode.getArgs());
    } else {
        final String operator;
        final boolean prefix;
        switch (tokenType) {
        case INCPOSTFIX:
            prefix = false;
            operator = "++";
            break;
        case DECPOSTFIX:
            prefix = false;
            operator = "--";
            break;
        case INCPREFIX:
            operator = "++";
            prefix = true;
            break;
        case DECPREFIX:
            operator = "--";
            prefix = true;
            break;
        default:
            prefix = true;
            operator = tokenType.getName();
            break;
        }

        type(unaryNode.isAssignment()? "UpdateExpression" : "UnaryExpression");
        comma();

        property("operator", operator);
        comma();

        property("prefix", prefix);
        comma();

        property("argument");
        unaryNode.getExpression().accept(this);
    }

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


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