Skip to content

Commit

Permalink
Make matchinstr extend callinstr vs base since it is a return value c…
Browse files Browse the repository at this point in the history
…all.

Unbreak IR persistence encode/decode for MatchInstr.
  • Loading branch information
enebo committed Jun 18, 2015
1 parent 7b22490 commit 5387c34
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions core/src/main/java/org/jruby/ir/instructions/MatchInstr.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jruby.ir.instructions;

import org.jruby.RubyRegexp;
import org.jruby.ir.IRScope;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
Expand All @@ -9,33 +8,15 @@
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.CallType;
import org.jruby.runtime.DynamicScope;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.callsite.CachingCallSite;
import org.jruby.runtime.callsite.NormalCachingCallSite;

import static org.jruby.ir.IRFlags.USES_BACKREF_OR_LASTLINE;

public class MatchInstr extends CallBase implements FixedArityInstr, ResultInstr {
protected Variable result;

public class MatchInstr extends CallInstr implements FixedArityInstr {
public MatchInstr(Variable result, Operand receiver, Operand arg) {
super(Operation.MATCH, CallType.NORMAL, "=~", receiver, new Operand[]{arg}, null, false);
super(Operation.MATCH, CallType.NORMAL, result, "=~", receiver, new Operand[]{arg}, null, false);

assert result != null : "Match2Instr result is null";

this.result = result;
}

public Variable getResult() {
return result;
}

public void updateResult(Variable v) {
this.result = v;
}

@Override
Expand All @@ -54,7 +35,8 @@ public Instr clone(CloneInfo ii) {

@Override
public void encode(IRWriterEncoder e) {
super.encode(e);
e.encode(getOperation());
e.encode(getResult());
e.encode(getReceiver());
e.encode(getArg1());
}
Expand Down

0 comments on commit 5387c34

Please sign in to comment.