[macruby-changes] [2200] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Mon Aug 3 18:23:49 PDT 2009
Revision: 2200
http://trac.macosforge.org/projects/ruby/changeset/2200
Author: lsansonetti at apple.com
Date: 2009-08-03 18:23:49 -0700 (Mon, 03 Aug 2009)
Log Message:
-----------
fixed super within a method that has a splat argument
Modified Paths:
--------------
MacRuby/branches/experimental/compiler.cpp
MacRuby/branches/experimental/compiler.h
Modified: MacRuby/branches/experimental/compiler.cpp
===================================================================
--- MacRuby/branches/experimental/compiler.cpp 2009-08-04 01:23:21 UTC (rev 2199)
+++ MacRuby/branches/experimental/compiler.cpp 2009-08-04 01:23:49 UTC (rev 2200)
@@ -43,6 +43,7 @@
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 @@
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 @@
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;
Modified: MacRuby/branches/experimental/compiler.h
===================================================================
--- MacRuby/branches/experimental/compiler.h 2009-08-04 01:23:21 UTC (rev 2199)
+++ MacRuby/branches/experimental/compiler.h 2009-08-04 01:23:49 UTC (rev 2200)
@@ -80,6 +80,7 @@
BasicBlock *bb;
BasicBlock *entry_bb;
ID current_mid;
+ rb_vm_arity_t current_arity;
bool current_instance_method;
ID self_id;
Value *current_self;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090803/c1aa7e95/attachment.html>
More information about the macruby-changes
mailing list