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


Java Node类代码示例

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


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

示例1: enterCatchNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public boolean enterCatchNode(final CatchNode catchNode) {
    enterDefault(catchNode);

    type("CatchClause");
    comma();

    property("param");
    catchNode.getException().accept(this);
    comma();

    final Node guard = catchNode.getExceptionCondition();
    if (guard != null) {
        property("guard");
        guard.accept(this);
        comma();
    }

    property("body");
    catchNode.getBody().accept(this);

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

示例2: leaveForNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveForNode(final ForNode forNode) {
    ForNode newForNode = forNode;

    final Expression test = forNode.getTest();
    if (!forNode.isForIn() && isAlwaysTrue(test)) {
        newForNode = forNode.setTest(lc, null);
    }

    newForNode = checkEscape(newForNode);
    if(newForNode.isForIn()) {
        // Wrap it in a block so its internally created iterator is restricted in scope
        addStatementEnclosedInBlock(newForNode);
    } else {
        addStatement(newForNode);
    }
    return newForNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Lower.java

示例3: pop

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public <T extends Node> T pop(final T node) {
    final T popped = super.pop(node);
    if (isWithBoundary(node)) {
        dynamicScopeCount--;
        assert dynamicScopeCount >= 0;
    } else if (node instanceof FunctionNode) {
        if (((FunctionNode)node).inDynamicContext()) {
            dynamicScopeCount--;
            assert dynamicScopeCount >= 0;
        }
        assert splitNodes.peek() == 0;
        splitNodes.pop();
    }
    return popped;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:CodeGeneratorLexicalContext.java

示例4: leaveExpressionStatement

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveExpressionStatement(final ExpressionStatement expressionStatement) {
    final Expression expr = expressionStatement.getExpression();
    ExpressionStatement node = expressionStatement;

    final FunctionNode currentFunction = lc.getCurrentFunction();

    if (currentFunction.isProgram()) {
        if (!isInternalExpression(expr) && !isEvalResultAssignment(expr)) {
            node = expressionStatement.setExpression(
                new BinaryNode(
                    Token.recast(
                        expressionStatement.getToken(),
                        TokenType.ASSIGN),
                    compilerConstant(RETURN),
                expr));
        }
    }

    if (es6 && expressionStatement.destructuringDeclarationType() != null) {
        throwNotImplementedYet("es6.destructuring", expressionStatement);
    }

    return addStatement(node);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:Lower.java

示例5: leaveIdentNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveIdentNode(final IdentNode identNode) {
    if (identNode.isPropertyName()) {
        return identNode;
    }

    final Symbol symbol = nameIsUsed(identNode.getName(), identNode);

    if (!identNode.isInitializedHere()) {
        symbol.increaseUseCount();
    }

    IdentNode newIdentNode = identNode.setSymbol(symbol);

    // If a block-scoped var is used before its declaration mark it as dead.
    // We can only statically detect this for local vars, cross-function symbols require runtime checks.
    if (symbol.isBlockScoped() && !symbol.hasBeenDeclared() && !identNode.isDeclaredHere() && isLocal(lc.getCurrentFunction(), symbol)) {
        newIdentNode = newIdentNode.markDead();
    }

    return end(newIdentNode);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:AssignSymbols.java

示例6: start

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
private boolean start(final Node node, final boolean printNode) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();

        sb.append("[ENTER ").
            append(name(node)).
            append("] ").
            append(printNode ? node.toString() : "").
            append(" in '").
            append(lc.getCurrentFunction().getName()).
            append("'");
        log.info(sb);
        log.indent();
    }

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

示例7: leaveTYPEOF

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

示例8: leaveForNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveForNode(final ForNode forNode) {
    ForNode newForNode = forNode;

    final Expression test = forNode.getTest();
    if (!forNode.isForInOrOf() && isAlwaysTrue(test)) {
        newForNode = forNode.setTest(lc, null);
    }

    newForNode = checkEscape(newForNode);
    if(!es6 && newForNode.isForInOrOf()) {
        // Wrap it in a block so its internally created iterator is restricted in scope, unless we are running
        // in ES6 mode, in which case the parser already created a block to capture let/const declarations.
        addStatementEnclosedInBlock(newForNode);
    } else {
        addStatement(newForNode);
    }
    return newForNode;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:Lower.java

示例9: leaveIdentNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveIdentNode(final IdentNode identNode) {
    if(identNode.isPropertyName()) {
        return identNode;
    }
    return setProgramPoint(identNode);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:ProgramPoints.java

示例10: isNumericArray

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
private static boolean isNumericArray(final Node[] values) {
    for (final Node node : values) {
        if (node instanceof LiteralNode && ((LiteralNode<?>)node).getValue() instanceof Number) {
            continue;
        }
        return false;
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:JSONFunctions.java

示例11: end

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
private <T extends Node> T end(final T node, final boolean printNode) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();

        sb.append("[LEAVE ").
            append(name(node)).
            append("] ").
            append(printNode ? node.toString() : "").
            append(" in '").
            append(lc.getCurrentFunction().getName()).
            append('\'');

        if (node instanceof IdentNode) {
            final Symbol symbol = ((IdentNode)node).getSymbol();
            if (symbol == null) {
                sb.append(" <NO SYMBOL>");
            } else {
                sb.append(" <symbol=").append(symbol).append('>');
            }
        }

        log.unindent();
        log.info(sb);
    }

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

示例12: leaveLiteralNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveLiteralNode(final LiteralNode<?> literalNode) {
    //for e.g. ArrayLiteralNodes the initial types may have been narrowed due to the
    //introduction of optimistic behavior - hence ensure that all literal nodes are
    //reinitialized
    return literalNode.initialize(lc);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:LocalVariableTypesCalculator.java

示例13: leaveCaseNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveCaseNode(final CaseNode caseNode) {
    // Try to represent the case test as an integer
    final Node test = caseNode.getTest();
    if (test instanceof LiteralNode) {
        final LiteralNode<?> lit = (LiteralNode<?>)test;
        if (lit.isNumeric() && !(lit.getValue() instanceof Integer)) {
            if (JSType.isRepresentableAsInt(lit.getNumber())) {
                return caseNode.setTest((Expression)LiteralNode.newInstance(lit, lit.getInt32()).accept(this));
            }
        }
    }
    return caseNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Lower.java

示例14: leaveTernaryNode

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
public Node leaveTernaryNode(final TernaryNode ternaryNode) {
    final Node test = ternaryNode.getTest();
    if (test instanceof LiteralNode.PrimitiveLiteralNode) {
        return (((LiteralNode.PrimitiveLiteralNode<?>)test).isTrue() ? ternaryNode.getTrueExpression() : ternaryNode.getFalseExpression()).getExpression();
    }
    return ternaryNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:FoldConstants.java

示例15: enterDefault

import jdk.nashorn.internal.ir.Node; //导入依赖的package包/类
@Override
protected boolean enterDefault(final Node node) {
    objectStart();
    location(node);

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


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