ExpressionTree expression = update.get( 0 ).getExpression(); JCTree.JCBinary cond = (JCTree.JCBinary)condition; if( cond.getTag() == JCTree.Tag.LT && inizST instanceof JCTree.JCVariableDecl && expression instanceof JCTree.JCUnary ) String var = cond.getLeftOperand().accept( this, v ); if( var.equals( up.getExpression().accept( this, v ) ) && var.equals( iniz.getName().toString() ) && "0".equals( iniz.getInitializer().accept( this, v ) ) ) JCTree.JCExpression condRight = cond.getRightOperand(); boolean validLimit = false; String condR = condRight.accept( this, v );
JCTree.JCExpression leftOperand = binary.getLeftOperand(); JCTree.JCExpression rightOperand = binary.getRightOperand();
ExpressionTree expression = update.get(0).getExpression(); JCTree.JCBinary cond = (JCTree.JCBinary) condition; if (cond.getTag() == JCTree.Tag.LT && inizST instanceof JCTree.JCVariableDecl && expression instanceof JCTree.JCUnary) { JCTree.JCVariableDecl iniz = (JCTree.JCVariableDecl) inizST; JCTree.JCUnary up = (JCTree.JCUnary) expression; String var = cond.getLeftOperand().accept(this, v); if (var.equals(up.getExpression().accept(this, v)) && var.equals(iniz.getName().toString()) && (up.getTag() == JCTree.Tag.PREINC || up.getTag() == JCTree.Tag.POSTINC) && "0".equals(iniz.getInitializer().accept(this, v))) { JCTree.JCExpression condRight = cond.getRightOperand(); boolean validLimit = false; String condR = condRight.accept(this, v);
if (operator.opcode == string_add) { makeStringBuffer(tree.pos()); bufferToString(tree.pos()); result = items.makeStackItem(syms.stringType); } else if (tree.hasTag(AND)) { CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER); if (!lcond.isFalse()) { result = lcond; } else if (tree.hasTag(OR)) { CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER); if (!lcond.isTrue()) {
if (operator.opcode == string_add) { makeStringBuffer(tree.pos()); bufferToString(tree.pos()); result = items.makeStackItem(syms.stringType); } else if (tree.hasTag(AND)) { CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER); if (!lcond.isFalse()) { result = lcond; } else if (tree.hasTag(OR)) { CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER); if (!lcond.isTrue()) {
if (operator.opcode == string_add) { makeStringBuffer(tree.pos()); bufferToString(tree.pos()); result = items.makeStackItem(syms.stringType); } else if (tree.getTag() == JCTree.AND) { CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER); if (!lcond.isFalse()) { result = lcond; } else if (tree.getTag() == JCTree.OR) { CondItem lcond = genCond(tree.lhs, CRT_FLOW_CONTROLLER); if (!lcond.isTrue()) {
public void visitBinary(JCBinary tree) { List<Type> formals = tree.operator.type.getParameterTypes(); JCTree lhs = tree.lhs = translate(tree.lhs, formals.head); switch (tree.getTag()) { case OR: if (lhs.type.isTrue()) { result = lhs; return; } if (lhs.type.isFalse()) { result = translate(tree.rhs, formals.tail.head); return; } break; case AND: if (lhs.type.isFalse()) { result = lhs; return; } if (lhs.type.isTrue()) { result = translate(tree.rhs, formals.tail.head); return; } break; } tree.rhs = translate(tree.rhs, formals.tail.head); result = tree; }
public void visitBinary(JCBinary tree) { switch (tree.getTag()) { case AND: scanCond(tree.lhs); final Bits initsWhenFalseLeft = new Bits(initsWhenFalse); final Bits uninitsWhenFalseLeft = new Bits(uninitsWhenFalse); inits.assign(initsWhenTrue); uninits.assign(uninitsWhenTrue); scanCond(tree.rhs); initsWhenFalse.andSet(initsWhenFalseLeft); uninitsWhenFalse.andSet(uninitsWhenFalseLeft); break; case OR: scanCond(tree.lhs); final Bits initsWhenTrueLeft = new Bits(initsWhenTrue); final Bits uninitsWhenTrueLeft = new Bits(uninitsWhenTrue); inits.assign(initsWhenFalse); uninits.assign(uninitsWhenFalse); scanCond(tree.rhs); initsWhenTrue.andSet(initsWhenTrueLeft); uninitsWhenTrue.andSet(uninitsWhenTrueLeft); break; default: scanExpr(tree.lhs); scanExpr(tree.rhs); } }
@Override public void visitBinary(JCBinary tree) { int ownprec = TreeInfo.opPrec(tree.getTag()); Name opname = operators.operatorName(tree.getTag()); int col = out.col; printExpr(tree.lhs, ownprec); print(opname); boolean needsSpace = cs.spaceAroundBinaryOps() || (tree.getTag() == JCTree.Tag.PLUS && (tree.rhs.getTag() == JCTree.Tag.POS || tree.rhs.getTag() == JCTree.Tag.PREINC)) || (tree.getTag() == JCTree.Tag.MINUS && (tree.rhs.getTag() == JCTree.Tag.NEG || tree.rhs.getTag() == JCTree.Tag.PREDEC)); int rm = cs.getRightMargin(); switch(cs.wrapBinaryOps()) {
public void visitBinary(JCBinary tree) { switch (tree.getTag()) { case JCTree.AND: scanCond(tree.lhs); Bits initsWhenFalseLeft = initsWhenFalse; Bits uninitsWhenFalseLeft = uninitsWhenFalse; inits = initsWhenTrue; uninits = uninitsWhenTrue; scanCond(tree.rhs); initsWhenFalse.andSet(initsWhenFalseLeft); uninitsWhenFalse.andSet(uninitsWhenFalseLeft); break; case JCTree.OR: scanCond(tree.lhs); Bits initsWhenTrueLeft = initsWhenTrue; Bits uninitsWhenTrueLeft = uninitsWhenTrue; inits = initsWhenFalse; uninits = uninitsWhenFalse; scanCond(tree.rhs); initsWhenTrue.andSet(initsWhenTrueLeft); uninitsWhenTrue.andSet(uninitsWhenTrueLeft); break; default: scanExpr(tree.lhs); scanExpr(tree.rhs); } }
public void visitBinary(JCBinary tree) { List<Type> formals = tree.operator.type.getParameterTypes(); JCTree lhs = tree.lhs = translate(tree.lhs, formals.head); switch (tree.getTag()) { case JCTree.OR: if (lhs.type.isTrue()) { result = lhs; return; } if (lhs.type.isFalse()) { result = translate(tree.rhs, formals.tail.head); return; } break; case JCTree.AND: if (lhs.type.isFalse()) { result = lhs; return; } if (lhs.type.isTrue()) { result = translate(tree.rhs, formals.tail.head); return; } break; } tree.rhs = translate(tree.rhs, formals.tail.head); result = tree; }
public void visitBinary(JCBinary tree) { List<Type> formals = tree.operator.type.getParameterTypes(); JCTree lhs = tree.lhs = translate(tree.lhs, formals.head); switch (tree.getTag()) { case OR: if (lhs.type.isTrue()) { result = lhs; return; } if (lhs.type.isFalse()) { result = translate(tree.rhs, formals.tail.head); return; } break; case AND: if (lhs.type.isFalse()) { result = lhs; return; } if (lhs.type.isTrue()) { result = translate(tree.rhs, formals.tail.head); return; } break; } tree.rhs = translate(tree.rhs, formals.tail.head); result = tree; }
public void visitBinary(JCBinary tree) { switch (tree.getTag()) { case AND: scanCond(tree.lhs); final Bits initsWhenFalseLeft = new Bits(initsWhenFalse); final Bits uninitsWhenFalseLeft = new Bits(uninitsWhenFalse); assignToInits(tree.lhs, initsWhenTrue); uninits.assign(uninitsWhenTrue); scanCond(tree.rhs); initsWhenFalse.andSet(initsWhenFalseLeft); uninitsWhenFalse.andSet(uninitsWhenFalseLeft); break; case OR: scanCond(tree.lhs); final Bits initsWhenTrueLeft = new Bits(initsWhenTrue); final Bits uninitsWhenTrueLeft = new Bits(uninitsWhenTrue); assignToInits(tree.lhs, initsWhenFalse); uninits.assign(uninitsWhenFalse); scanCond(tree.rhs); initsWhenTrue.andSet(initsWhenTrueLeft); uninitsWhenTrue.andSet(uninitsWhenTrueLeft); break; default: scanExpr(tree.lhs); scanExpr(tree.rhs); } }
@Override public void visitBinary( JCBinary tree ) { Env<AttrContext> env = getField( this, "env" ); Type left = attribExpr( tree.lhs, env ); Type right = attribExpr( tree.rhs, env ); OperatorMethod foundOpMeth = null; for( OperatorMethod opMeth : ops ) { opMeth.resolve( reader, names, rs, types, env ); if( tree.getTag() == opMeth.op && types.isAssignable( opMeth.arg0, left ) && types.isAssignable( opMeth.arg1, right ) ) { foundOpMeth = opMeth; break; } } if( foundOpMeth != null ) { tree.type = foundOpMeth.res; tree.operator = foundOpMeth.sym; setField( this, "result", tree.type ); debug( "Attributing overloaded operator '" + foundOpMeth.op + "' tree type to '" + tree.type + "'" ); } else { super.visitBinary( tree ); } }
@Override public void visitBinary( JCBinary tree ) { super.visitBinary( tree ); OperatorMethod foundOpMeth = null; for( OperatorMethod opMeth : ops ) { if( tree.getTag() == opMeth.op && types.isAssignable( opMeth.arg0, tree.lhs.type ) && types.isAssignable( opMeth.arg1, tree.rhs.type ) ) { foundOpMeth = opMeth; break; } } if( foundOpMeth != null ) { result = make.Apply( List.<JCExpression> nil(), make.Select( make.Ident( foundOpMeth.sym.owner ), foundOpMeth.sym ).setType( foundOpMeth.mt ), List.of( tree.lhs, tree.rhs ) ) .setType( foundOpMeth.res ); debug( "Replacing overloaded operator '" + foundOpMeth.op + "' by call to '" + foundOpMeth.sym + "'" ); } }