Skip to content

Commit

Permalink
dregexp and dstr are always "expression". Even in the code I removed
Browse files Browse the repository at this point in the history
but MRI does not evaluate either construct so there is not possibility
of defined? triggering any side-effects.  This commits evaluation so
we will not either.
enebo committed Jul 15, 2016
1 parent 9cdc983 commit 8d47b00
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -1444,30 +1444,7 @@ public Operand buildGetDefinition(Node node) {
case TRUENODE:
return new FrozenString("true");
case DREGEXPNODE: case DSTRNODE: {
final Node dNode = node;

// protected code
CodeBlock protectedCode = new CodeBlock() {
public Operand run() {
build(dNode);
// always an expression as long as we get through here without an exception!
return new FrozenString("expression");
}
};
// rescue block
CodeBlock rescueBlock = new CodeBlock() {
public Operand run() { return manager.getNil(); } // Nothing to do if we got an exception
};

// Try verifying definition, and if we get an JumpException exception, process it with the rescue block above
Operand v = protectCodeWithRescue(protectedCode, rescueBlock);
Label doneLabel = getNewLabel();
Variable tmpVar = getValueInTemporaryVariable(v);
addInstr(BNEInstr.create(doneLabel, tmpVar, manager.getNil()));
addInstr(new CopyInstr(tmpVar, new FrozenString("expression")));
addInstr(new LabelInstr(doneLabel));

return tmpVar;
return new FrozenString("expression");
}
case ARRAYNODE: { // If all elts of array are defined the array is as well
ArrayNode array = (ArrayNode) node;

0 comments on commit 8d47b00

Please sign in to comment.