Permalink
Browse files

[1.9] Fix SValue in compiler. Plenty of RubySpecs for it already.

  • Loading branch information...
1 parent d541911 commit cb6038f5e8509292d84bfbeb24359a1b1c33eb25 @headius headius committed with yokolet Jan 7, 2011
@@ -45,6 +45,7 @@
import org.jruby.ast.MultipleAsgnNode;
import org.jruby.ast.NodeType;
import org.jruby.ast.OptArgNode;
+import org.jruby.ast.SValue19Node;
import org.jruby.ast.StarNode;
import org.jruby.runtime.Arity;
import org.jruby.runtime.BlockBody;
@@ -408,6 +409,17 @@ public void call(BodyCompiler context) {
}
@Override
+ public void compileSValue(Node node, BodyCompiler context, boolean expr) {
+ SValue19Node svalueNode = (SValue19Node)node;
+
+ compile(svalueNode.getValue(), context,true);
+
+ context.singlifySplattedValue19();
+ // TODO: don't require pop
+ if (!expr) context.consumeCurrentValue();
+ }
+
+ @Override
protected void splatCurrentValue(BodyCompiler context) {
context.splatCurrentValue("splatValue19");
}
@@ -471,6 +471,11 @@ public void defineNewMethod(String name, int methodArity, StaticScope scope,
* zero, use nil
*/
public void singlifySplattedValue();
+
+ /**
+ * 1.9 version of singlifySplattedValue.
+ */
+ public void singlifySplattedValue19();
/**
* Given an IRubyObject[] on the stack (or otherwise available as the present object)
@@ -1212,6 +1212,10 @@ public void singlifySplattedValue() {
method.invokestatic(p(RuntimeHelpers.class), "aValueSplat", sig(IRubyObject.class, params(IRubyObject.class)));
}
+ public void singlifySplattedValue19() {
+ method.invokestatic(p(RuntimeHelpers.class), "aValueSplat19", sig(IRubyObject.class, params(IRubyObject.class)));
+ }
+
public void aryToAry() {
method.invokestatic(p(RuntimeHelpers.class), "aryToAry", sig(IRubyObject.class, params(IRubyObject.class)));
}

0 comments on commit cb6038f

Please sign in to comment.