< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java

Print this page

        

*** 1699,1709 **** if (condtype.constValue() != null && truetype.constValue() != null && falsetype.constValue() != null && !owntype.hasTag(NONE)) { //constant folding ! owntype = cfolder.coerce(condtype.isTrue() ? truetype : falsetype, owntype); } result = check(tree, owntype, KindSelector.VAL, resultInfo); } //where private boolean isBooleanOrNumeric(Env<AttrContext> env, JCExpression tree) { --- 1699,1709 ---- if (condtype.constValue() != null && truetype.constValue() != null && falsetype.constValue() != null && !owntype.hasTag(NONE)) { //constant folding ! owntype = cfolder.coerce(ConstFold.isTrue(condtype.getTag(), condtype.constValue()) ? truetype : falsetype, owntype); } result = check(tree, owntype, KindSelector.VAL, resultInfo); } //where private boolean isBooleanOrNumeric(Env<AttrContext> env, JCExpression tree) {
*** 3570,3580 **** : operator.type.getReturnType(); int opc = ((OperatorSymbol)operator).opcode; // If the argument is constant, fold it. if (argtype.constValue() != null) { ! Type ctype = cfolder.fold1(opc, argtype); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype); } } } --- 3570,3580 ---- : operator.type.getReturnType(); int opc = ((OperatorSymbol)operator).opcode; // If the argument is constant, fold it. if (argtype.constValue() != null) { ! Type ctype = cfolder.fold1((OperatorSymbol)operator, argtype); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype); } } }
*** 3593,3603 **** !right.isErroneous()) { owntype = operator.type.getReturnType(); int opc = ((OperatorSymbol)operator).opcode; // If both arguments are constants, fold them. if (left.constValue() != null && right.constValue() != null) { ! Type ctype = cfolder.fold2(opc, left, right); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype); } } --- 3593,3603 ---- !right.isErroneous()) { owntype = operator.type.getReturnType(); int opc = ((OperatorSymbol)operator).opcode; // If both arguments are constants, fold them. if (left.constValue() != null && right.constValue() != null) { ! Type ctype = cfolder.fold2((OperatorSymbol)operator, left, right); if (ctype != null) { owntype = cfolder.coerce(ctype, owntype); } }
< prev index next >