Java 类jdk.nashorn.internal.ir.TernaryNode 实例源码

项目:OpenJSharp    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:OpenJSharp    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    final Expression test = ternaryNode.getTest();
    final Expression trueExpr = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    test.accept(this);

    final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
    if(!isAlwaysFalse(test)) {
        trueExpr.accept(this);
    }
    final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
    localVariableTypes = testExitLvarTypes;
    if(!isAlwaysTrue(test)) {
        falseExpr.accept(this);
    }
    final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
    localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
    setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
    setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);
    return false;
}
项目:OpenJSharp    文件:CodeGenerator.java   
private void loadTernaryNode(final TernaryNode ternaryNode, final TypeBounds resultBounds) {
    final Expression test = ternaryNode.getTest();
    final JoinPredecessorExpression trueExpr  = ternaryNode.getTrueExpression();
    final JoinPredecessorExpression falseExpr = ternaryNode.getFalseExpression();

    final Label falseLabel = new Label("ternary_false");
    final Label exitLabel  = new Label("ternary_exit");

    final Type outNarrowest = Type.narrowest(resultBounds.widest, Type.generic(Type.widestReturnType(trueExpr.getType(), falseExpr.getType())));
    final TypeBounds outBounds = resultBounds.notNarrowerThan(outNarrowest);

    emitBranch(test, falseLabel, false);

    loadExpression(trueExpr.getExpression(), outBounds);
    assert Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(trueExpr);
    method._goto(exitLabel);
    method.label(falseLabel);
    loadExpression(falseExpr.getExpression(), outBounds);
    assert Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(falseExpr);
    method.label(exitLabel);
}
项目:openjdk-jdk10    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:openjdk-jdk10    文件:CodeGenerator.java   
private void loadTernaryNode(final TernaryNode ternaryNode, final TypeBounds resultBounds) {
    final Expression test = ternaryNode.getTest();
    final JoinPredecessorExpression trueExpr  = ternaryNode.getTrueExpression();
    final JoinPredecessorExpression falseExpr = ternaryNode.getFalseExpression();

    final Label falseLabel = new Label("ternary_false");
    final Label exitLabel  = new Label("ternary_exit");

    final Type outNarrowest = Type.narrowest(resultBounds.widest, Type.generic(Type.widestReturnType(trueExpr.getType(), falseExpr.getType())));
    final TypeBounds outBounds = resultBounds.notNarrowerThan(outNarrowest);

    emitBranch(test, falseLabel, false);

    final boolean isCurrentDiscard = lc.popDiscardIfCurrent(ternaryNode);
    loadMaybeDiscard(isCurrentDiscard, trueExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(trueExpr);
    method._goto(exitLabel);
    method.label(falseLabel);
    loadMaybeDiscard(isCurrentDiscard, falseExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(falseExpr);
    method.label(exitLabel);
}
项目:openjdk9    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:openjdk9    文件:CodeGenerator.java   
private void loadTernaryNode(final TernaryNode ternaryNode, final TypeBounds resultBounds) {
    final Expression test = ternaryNode.getTest();
    final JoinPredecessorExpression trueExpr  = ternaryNode.getTrueExpression();
    final JoinPredecessorExpression falseExpr = ternaryNode.getFalseExpression();

    final Label falseLabel = new Label("ternary_false");
    final Label exitLabel  = new Label("ternary_exit");

    final Type outNarrowest = Type.narrowest(resultBounds.widest, Type.generic(Type.widestReturnType(trueExpr.getType(), falseExpr.getType())));
    final TypeBounds outBounds = resultBounds.notNarrowerThan(outNarrowest);

    emitBranch(test, falseLabel, false);

    final boolean isCurrentDiscard = lc.popDiscardIfCurrent(ternaryNode);
    loadMaybeDiscard(isCurrentDiscard, trueExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(trueExpr);
    method._goto(exitLabel);
    method.label(falseLabel);
    loadMaybeDiscard(isCurrentDiscard, falseExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(falseExpr);
    method.label(exitLabel);
}
项目:kaziranga    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:kaziranga    文件:CodeGenerator.java   
private void loadTernaryNode(final TernaryNode ternaryNode, final TypeBounds resultBounds) {
    final Expression test = ternaryNode.getTest();
    final JoinPredecessorExpression trueExpr  = ternaryNode.getTrueExpression();
    final JoinPredecessorExpression falseExpr = ternaryNode.getFalseExpression();

    final Label falseLabel = new Label("ternary_false");
    final Label exitLabel  = new Label("ternary_exit");

    final Type outNarrowest = Type.narrowest(resultBounds.widest, Type.generic(Type.widestReturnType(trueExpr.getType(), falseExpr.getType())));
    final TypeBounds outBounds = resultBounds.notNarrowerThan(outNarrowest);

    emitBranch(test, falseLabel, false);

    final boolean isCurrentDiscard = lc.popDiscardIfCurrent(ternaryNode);
    loadMaybeDiscard(isCurrentDiscard, trueExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(trueExpr);
    method._goto(exitLabel);
    method.label(falseLabel);
    loadMaybeDiscard(isCurrentDiscard, falseExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(falseExpr);
    method.label(exitLabel);
}
项目:lookaside_java-1.8.0-openjdk    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:lookaside_java-1.8.0-openjdk    文件:CodeGenerator.java   
private void loadTernaryNode(final TernaryNode ternaryNode, final TypeBounds resultBounds) {
    final Expression test = ternaryNode.getTest();
    final JoinPredecessorExpression trueExpr  = ternaryNode.getTrueExpression();
    final JoinPredecessorExpression falseExpr = ternaryNode.getFalseExpression();

    final Label falseLabel = new Label("ternary_false");
    final Label exitLabel  = new Label("ternary_exit");

    final Type outNarrowest = Type.narrowest(resultBounds.widest, Type.generic(Type.widestReturnType(trueExpr.getType(), falseExpr.getType())));
    final TypeBounds outBounds = resultBounds.notNarrowerThan(outNarrowest);

    emitBranch(test, falseLabel, false);

    final boolean isCurrentDiscard = lc.popDiscardIfCurrent(ternaryNode);
    loadMaybeDiscard(isCurrentDiscard, trueExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(trueExpr);
    method._goto(exitLabel);
    method.label(falseLabel);
    loadMaybeDiscard(isCurrentDiscard, falseExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(falseExpr);
    method.label(exitLabel);
}
项目:jdk8u_nashorn    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:jdk8u_nashorn    文件:CodeGenerator.java   
private void loadTernaryNode(final TernaryNode ternaryNode, final TypeBounds resultBounds) {
    final Expression test = ternaryNode.getTest();
    final JoinPredecessorExpression trueExpr  = ternaryNode.getTrueExpression();
    final JoinPredecessorExpression falseExpr = ternaryNode.getFalseExpression();

    final Label falseLabel = new Label("ternary_false");
    final Label exitLabel  = new Label("ternary_exit");

    final Type outNarrowest = Type.narrowest(resultBounds.widest, Type.generic(Type.widestReturnType(trueExpr.getType(), falseExpr.getType())));
    final TypeBounds outBounds = resultBounds.notNarrowerThan(outNarrowest);

    emitBranch(test, falseLabel, false);

    final boolean isCurrentDiscard = lc.popDiscardIfCurrent(ternaryNode);
    loadMaybeDiscard(isCurrentDiscard, trueExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(trueExpr);
    method._goto(exitLabel);
    method.label(falseLabel);
    loadMaybeDiscard(isCurrentDiscard, falseExpr.getExpression(), outBounds);
    assert isCurrentDiscard || Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(falseExpr);
    method.label(exitLabel);
}
项目:infobip-open-jdk-8    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:infobip-open-jdk-8    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    final Expression test = ternaryNode.getTest();
    final Expression trueExpr = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    test.accept(this);

    final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
    if(!isAlwaysFalse(test)) {
        trueExpr.accept(this);
    }
    final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
    localVariableTypes = testExitLvarTypes;
    if(!isAlwaysTrue(test)) {
        falseExpr.accept(this);
    }
    final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
    localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
    setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
    setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);
    return false;
}
项目:infobip-open-jdk-8    文件:CodeGenerator.java   
private void loadTernaryNode(final TernaryNode ternaryNode, final TypeBounds resultBounds) {
    final Expression test = ternaryNode.getTest();
    final JoinPredecessorExpression trueExpr  = ternaryNode.getTrueExpression();
    final JoinPredecessorExpression falseExpr = ternaryNode.getFalseExpression();

    final Label falseLabel = new Label("ternary_false");
    final Label exitLabel  = new Label("ternary_exit");

    final Type outNarrowest = Type.narrowest(resultBounds.widest, Type.generic(Type.widestReturnType(trueExpr.getType(), falseExpr.getType())));
    final TypeBounds outBounds = resultBounds.notNarrowerThan(outNarrowest);

    emitBranch(test, falseLabel, false);

    loadExpression(trueExpr.getExpression(), outBounds);
    assert Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(trueExpr);
    method._goto(exitLabel);
    method.label(falseLabel);
    loadExpression(falseExpr.getExpression(), outBounds);
    assert Type.generic(method.peekType()) == outBounds.narrowest;
    method.beforeJoinPoint(falseExpr);
    method.label(exitLabel);
}
项目:OLD-OpenJDK8    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:OLD-OpenJDK8    文件:BranchOptimizer.java   
private void branchOptimizer(final Expression node, final Label label, final boolean state) {
    if (!(node instanceof TernaryNode)) {

        if (node instanceof BinaryNode) {
            branchOptimizer((BinaryNode)node, label, state);
            return;
        }

        if (node instanceof UnaryNode) {
            branchOptimizer((UnaryNode)node, label, state);
            return;
        }
    }

    codegen.load(node, Type.BOOLEAN);
    if (state) {
        method.ifne(label);
    } else {
        method.ifeq(label);
    }
}
项目:nashorn-backport    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:nashorn-backport    文件:BranchOptimizer.java   
private void branchOptimizer(final Expression node, final Label label, final boolean state) {
    if (!(node instanceof TernaryNode)) {

        if (node instanceof BinaryNode) {
            branchOptimizer((BinaryNode)node, label, state);
            return;
        }

        if (node instanceof UnaryNode) {
            branchOptimizer((UnaryNode)node, label, state);
            return;
        }
    }

    load(node);
    method.convert(Type.BOOLEAN);
    if (state) {
        method.ifne(label);
    } else {
        method.ifeq(label);
    }
}
项目:nashorn    文件:JSONWriter.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    enterDefault(ternaryNode);

    type("ConditionalExpression");
    comma();

    property("test");
    ternaryNode.getTest().accept(this);
    comma();

    property("consequent");
    ternaryNode.getTrueExpression().accept(this);
    comma();

    property("alternate");
    ternaryNode.getFalseExpression().accept(this);

    return leave();
}
项目:nashorn    文件:BranchOptimizer.java   
private void branchOptimizer(final Expression node, final Label label, final boolean state) {
    if (!(node instanceof TernaryNode)) {

        if (node instanceof BinaryNode) {
            branchOptimizer((BinaryNode)node, label, state);
            return;
        }

        if (node instanceof UnaryNode) {
            branchOptimizer((UnaryNode)node, label, state);
            return;
        }
    }

    load(node);
    method.convert(Type.BOOLEAN);
    if (state) {
        method.ifne(label);
    } else {
        method.ifeq(label);
    }
}
项目:OpenJSharp    文件:FoldConstants.java   
@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;
}
项目:openjdk-jdk10    文件:IRTranslator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    curExpr = new ConditionalExpressionTreeImpl(ternaryNode,
            translateExpr(ternaryNode.getTest()),
            translateExpr(ternaryNode.getTrueExpression()),
            translateExpr(ternaryNode.getFalseExpression()));
    return false;
}
项目:openjdk-jdk10    文件:ConditionalExpressionTreeImpl.java   
ConditionalExpressionTreeImpl(final TernaryNode node,
        final ExpressionTree condExpr, final ExpressionTree trueExpr,
        final ExpressionTree falseExpr) {
    super(node);
    this.condExpr = condExpr;
    this.trueExpr = trueExpr;
    this.falseExpr = falseExpr;

}
项目:openjdk-jdk10    文件:FoldConstants.java   
@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;
}
项目:openjdk-jdk10    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    final Expression test = ternaryNode.getTest();
    final Expression trueExpr = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    visitExpression(test);

    final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
    final LvarType trueType;
    if(!isAlwaysFalse(test)) {
        trueType = visitExpression(trueExpr);
    } else {
        trueType = null;
    }
    final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
    localVariableTypes = testExitLvarTypes;
    final LvarType falseType;
    if(!isAlwaysTrue(test)) {
        falseType = visitExpression(falseExpr);
    } else {
        falseType = null;
    }
    final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
    localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
    setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
    setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);

    typeStack.push(trueType != null ? falseType != null ? widestLvarType(trueType, falseType) : trueType : assertNotNull(falseType));
    return false;
}
项目:openjdk9    文件:IRTranslator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    curExpr = new ConditionalExpressionTreeImpl(ternaryNode,
            translateExpr(ternaryNode.getTest()),
            translateExpr(ternaryNode.getTrueExpression()),
            translateExpr(ternaryNode.getFalseExpression()));
    return false;
}
项目:openjdk9    文件:ConditionalExpressionTreeImpl.java   
ConditionalExpressionTreeImpl(final TernaryNode node,
        final ExpressionTree condExpr, final ExpressionTree trueExpr,
        final ExpressionTree falseExpr) {
    super(node);
    this.condExpr = condExpr;
    this.trueExpr = trueExpr;
    this.falseExpr = falseExpr;

}
项目:openjdk9    文件:FoldConstants.java   
@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;
}
项目:openjdk9    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    final Expression test = ternaryNode.getTest();
    final Expression trueExpr = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    visitExpression(test);

    final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
    final LvarType trueType;
    if(!isAlwaysFalse(test)) {
        trueType = visitExpression(trueExpr);
    } else {
        trueType = null;
    }
    final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
    localVariableTypes = testExitLvarTypes;
    final LvarType falseType;
    if(!isAlwaysTrue(test)) {
        falseType = visitExpression(falseExpr);
    } else {
        falseType = null;
    }
    final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
    localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
    setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
    setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);

    typeStack.push(trueType != null ? falseType != null ? widestLvarType(trueType, falseType) : trueType : assertNotNull(falseType));
    return false;
}
项目:kaziranga    文件:FoldConstants.java   
@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;
}
项目:kaziranga    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    final Expression test = ternaryNode.getTest();
    final Expression trueExpr = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    visitExpression(test);

    final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
    final LvarType trueType;
    if(!isAlwaysFalse(test)) {
        trueType = visitExpression(trueExpr);
    } else {
        trueType = null;
    }
    final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
    localVariableTypes = testExitLvarTypes;
    final LvarType falseType;
    if(!isAlwaysTrue(test)) {
        falseType = visitExpression(falseExpr);
    } else {
        falseType = null;
    }
    final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
    localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
    setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
    setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);

    typeStack.push(trueType != null ? falseType != null ? widestLvarType(trueType, falseType) : trueType : assertNotNull(falseType));
    return false;
}
项目:lookaside_java-1.8.0-openjdk    文件:FoldConstants.java   
@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;
}
项目:lookaside_java-1.8.0-openjdk    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    final Expression test = ternaryNode.getTest();
    final Expression trueExpr = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    visitExpression(test);

    final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
    final LvarType trueType;
    if(!isAlwaysFalse(test)) {
        trueType = visitExpression(trueExpr);
    } else {
        trueType = null;
    }
    final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
    localVariableTypes = testExitLvarTypes;
    final LvarType falseType;
    if(!isAlwaysTrue(test)) {
        falseType = visitExpression(falseExpr);
    } else {
        falseType = null;
    }
    final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
    localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
    setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
    setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);

    typeStack.push(trueType != null ? falseType != null ? widestLvarType(trueType, falseType) : trueType : assertNotNull(falseType));
    return false;
}
项目:jdk8u_nashorn    文件:FoldConstants.java   
@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;
}
项目:jdk8u_nashorn    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterTernaryNode(final TernaryNode ternaryNode) {
    final Expression test = ternaryNode.getTest();
    final Expression trueExpr = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    visitExpression(test);

    final Map<Symbol, LvarType> testExitLvarTypes = localVariableTypes;
    final LvarType trueType;
    if(!isAlwaysFalse(test)) {
        trueType = visitExpression(trueExpr);
    } else {
        trueType = null;
    }
    final Map<Symbol, LvarType> trueExitLvarTypes = localVariableTypes;
    localVariableTypes = testExitLvarTypes;
    final LvarType falseType;
    if(!isAlwaysTrue(test)) {
        falseType = visitExpression(falseExpr);
    } else {
        falseType = null;
    }
    final Map<Symbol, LvarType> falseExitLvarTypes = localVariableTypes;
    localVariableTypes = getUnionTypes(trueExitLvarTypes, falseExitLvarTypes);
    setConversion((JoinPredecessor)trueExpr, trueExitLvarTypes, localVariableTypes);
    setConversion((JoinPredecessor)falseExpr, falseExitLvarTypes, localVariableTypes);

    typeStack.push(trueType != null ? falseType != null ? widestLvarType(trueType, falseType) : trueType : assertNotNull(falseType));
    return false;
}
项目:infobip-open-jdk-8    文件:FoldConstants.java   
@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;
}
项目:OLD-OpenJDK8    文件:Attr.java   
@Override
public Node leaveTernaryNode(final TernaryNode ternaryNode) {
    final Expression trueExpr  = ternaryNode.getTrueExpression();
    final Expression falseExpr = ternaryNode.getFalseExpression();

    ensureTypeNotUnknown(trueExpr);
    ensureTypeNotUnknown(falseExpr);

    final Type type = widestReturnType(trueExpr.getType(), falseExpr.getType());
    return end(ensureSymbol(type, ternaryNode));
}
项目:OLD-OpenJDK8    文件:FoldConstants.java   
@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();
    }
    return ternaryNode;
}