Skip to content

Commit

Permalink
Fix boolean fatfinger.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Jan 12, 2015
1 parent 3c3edd5 commit 2a87593
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Expand Up @@ -1424,7 +1424,7 @@ public Operand run() {
}
case VCALLNODE:
return addResultInstr(scope, new RuntimeHelperCall(scope.createTemporaryVariable(), IS_DEFINED_METHOD,
new Operand[] { scope.getSelf(), new StringLiteral(((VCallNode) node).getName()), Boolean.FALSE}));
new Operand[] { scope.getSelf(), new StringLiteral(((VCallNode) node).getName()), manager.getFalse()}));
case YIELDNODE:
return buildDefinitionCheck(scope, new BlockGivenInstr(scope.createTemporaryVariable(), scope.getYieldClosureVariable()), "yield");
case ZSUPERNODE:
Expand Down Expand Up @@ -1491,7 +1491,7 @@ public Operand run() {
* ----------------------------------------------------------------- */
Label undefLabel = scope.getNewLabel();
Variable tmpVar = addResultInstr(scope, new RuntimeHelperCall(scope.createTemporaryVariable(), IS_DEFINED_METHOD,
new Operand[]{scope.getSelf(), new StringLiteral(((FCallNode) node).getName()), Boolean.FALSE}));
new Operand[]{scope.getSelf(), new StringLiteral(((FCallNode) node).getName()), manager.getFalse()}));
addInstr(scope, BEQInstr.create(tmpVar, manager.getNil(), undefLabel));
Operand argsCheckDefn = buildGetArgumentDefinition(((FCallNode) node).getArgsNode(), scope, "method");
return buildDefnCheckIfThenPaths(scope, undefLabel, argsCheckDefn);
Expand Down Expand Up @@ -1546,7 +1546,7 @@ public Operand run() {
Variable tmpVar = scope.createTemporaryVariable();
Operand receiver = build(attrAssign.getReceiverNode(), scope);
addInstr(scope, new RuntimeHelperCall(tmpVar, IS_DEFINED_METHOD,
new Operand[] { receiver, new StringLiteral(attrAssign.getName()), Boolean.TRUE }));
new Operand[] { receiver, new StringLiteral(attrAssign.getName()), manager.getTrue() }));
addInstr(scope, BEQInstr.create(tmpVar, manager.getNil(), undefLabel));
Operand argsCheckDefn = buildGetArgumentDefinition(attrAssign.getArgsNode(), scope, "assignment");
return buildDefnCheckIfThenPaths(scope, undefLabel, argsCheckDefn);
Expand Down Expand Up @@ -3200,7 +3200,7 @@ public Operand buildReturn(ReturnNode returnNode, IRScope s) {
// If this happens to be a module body, the runtime throws a local jump error if the
// closure is a proc. If the closure is a lambda, then this becomes a normal return.
IRMethod m = s.getNearestMethod();
addInstr(s, new RuntimeHelperCall(null, CHECK_FOR_LJE, new Operand[] { m == null ? Boolean.TRUE : Boolean.FALSE }));
addInstr(s, new RuntimeHelperCall(null, CHECK_FOR_LJE, new Operand[] { m == null ? manager.getTrue() : manager.getFalse() }));
retVal = processEnsureRescueBlocks(s, retVal);
addInstr(s, new NonlocalReturnInstr(retVal, m == null ? "--none--" : m.getName()));
} else if (s.isModuleBody()) {
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/java/org/jruby/ir/IRManager.java
Expand Up @@ -24,6 +24,8 @@ public class IRManager {
private int dummyMetaClassCount = 0;
private final IRModuleBody object = new IRClassBody(this, null, "Object", "", 0, null);
private final Nil nil = new Nil();
private final Boolean tru = new Boolean(true);
private final Boolean fals = new Boolean(false);

// Listeners for debugging and testing of IR
private Set<CompilerPassListener> passListeners = new HashSet<CompilerPassListener>();
Expand Down Expand Up @@ -62,11 +64,11 @@ public Nil getNil() {
}

public org.jruby.ir.operands.Boolean getTrue() {
return Boolean.TRUE;
return tru;
}

public org.jruby.ir.operands.Boolean getFalse() {
return Boolean.FALSE;
return fals;
}

public IRModuleBody getObject() {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/operands/Boolean.java
Expand Up @@ -9,7 +9,7 @@ public class Boolean extends ImmutableLiteral {
public static final Boolean TRUE = new Boolean(true);
public static final Boolean FALSE = new Boolean(false);

private Boolean(boolean truthy) {
public Boolean(boolean truthy) {
super(OperandType.BOOLEAN);

this.truthy = truthy;
Expand Down

0 comments on commit 2a87593

Please sign in to comment.