Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed super within a method that has a splat argument

  • Loading branch information...
commit 164ca93c02da4a94a47fa00ea1683a9df7e1dc54 1 parent 8397cfb
Laurent Sansonetti authored
Showing with 16 additions and 0 deletions.
  1. +15 −0 compiler.cpp
  2. +1 −0  compiler.h
View
15 compiler.cpp
@@ -43,6 +43,7 @@ RoxorCompiler::RoxorCompiler(void)
rescue_bb = NULL;
ensure_bb = NULL;
current_mid = 0;
+ current_arity = rb_vm_arity(-1);
current_instance_method = false;
self_id = rb_intern("self");
current_self = NULL;
@@ -2899,9 +2900,14 @@ RoxorCompiler::compile_node(NODE *node)
BranchInst::Create(entry_bb, bb);
bb = entry_bb;
+ rb_vm_arity_t old_current_arity = current_arity;
+ current_arity = arity;
+
DEBUG_LEVEL_INC();
val = compile_node(node->nd_body);
DEBUG_LEVEL_DEC();
+
+ current_arity = old_current_arity;
}
if (val == NULL) {
val = nilVal;
@@ -3781,8 +3787,17 @@ RoxorCompiler::compile_node(NODE *node)
Function::ArgumentListType::iterator iter = fargs.begin();
iter++; // skip self
iter++; // skip sel
+ const int rest_pos = current_arity.max == -1
+ ? (current_arity.left_req
+ + (current_arity.real - current_arity.min - 1))
+ : -1;
+ int i = 0;
while (iter != fargs.end()) {
+ if (i == rest_pos) {
+ params.push_back(splatArgFollowsVal);
+ }
params.push_back(iter);
+ ++i;
++iter;
}
argc = fargs_arity;
View
1  compiler.h
@@ -80,6 +80,7 @@ class RoxorCompiler {
BasicBlock *bb;
BasicBlock *entry_bb;
ID current_mid;
+ rb_vm_arity_t current_arity;
bool current_instance_method;
ID self_id;
Value *current_self;
Please sign in to comment.
Something went wrong with that request. Please try again.