Permalink
Browse files

For now, when a method recieves a block, use Lobby for the self value…

… when the block is called instead of the object the method is being called on.
  • Loading branch information...
1 parent ea6ecc1 commit 34c20e52b335fb76781b8d5b8eec956b45658f29 @orangea orangea committed Oct 16, 2010
Showing with 7 additions and 7 deletions.
  1. +3 −3 core/number.c
  2. +1 −1 core/string.c
  3. +3 −3 core/table.c
View
@@ -90,7 +90,7 @@ static PN potion_num_number(Potion *P, PN closure, PN self) {
static PN potion_num_step(Potion *P, PN cl, PN self, PN end, PN step, PN block) {
long i, j = PN_INT(end), k = PN_INT(step);
for (i = PN_INT(self); i <= j; i += k) {
- PN_CLOSURE(block)->method(P, block, self, PN_NUM(i));
+ PN_CLOSURE(block)->method(P, block, P->lobby, PN_NUM(i));
}
}
@@ -110,15 +110,15 @@ PN potion_num_string(Potion *P, PN closure, PN self) {
static PN potion_num_times(Potion *P, PN cl, PN self, PN block) {
long i, j = PN_INT(self);
for (i = 0; i < j; i++)
- PN_CLOSURE(block)->method(P, block, self, PN_NUM(i));
+ PN_CLOSURE(block)->method(P, block, P->lobby, PN_NUM(i));
return PN_NUM(i);
}
PN potion_num_to(Potion *P, PN cl, PN self, PN end, PN block) {
long i, s = 1, j = PN_INT(self), k = PN_INT(end);
if (k < j) s = -1;
for (i = j; i != k + s; i += s)
- PN_CLOSURE(block)->method(P, block, self, PN_NUM(i));
+ PN_CLOSURE(block)->method(P, block, P->lobby, PN_NUM(i));
return PN_NUM(abs(i - j));
}
View
@@ -276,7 +276,7 @@ static PN potion_bytes_each(Potion *P, PN cl, PN self, PN block) {
char *s = PN_STR_PTR(self);
int i;
for (i = 0; i < PN_STR_LEN(self); i++) {
- PN_CLOSURE(block)->method(P, block, self, potion_byte_str2(P, &s[i], 1));
+ PN_CLOSURE(block)->method(P, block, P->lobby, potion_byte_str2(P, &s[i], 1));
}
return PN_NIL;
}
View
@@ -60,7 +60,7 @@ PN potion_table_each(Potion *P, PN cl, PN self, PN block) {
unsigned k;
for (k = kh_begin(t); k != kh_end(t); ++k)
if (kh_exist(PN, t, k)) {
- PN_CLOSURE(block)->method(P, block, self, kh_key(PN, t, k), kh_val(PN, t, k));
+ PN_CLOSURE(block)->method(P, block, P->lobby, kh_key(PN, t, k), kh_val(PN, t, k));
}
return self;
}
@@ -158,9 +158,9 @@ PN potion_tuple_each(Potion *P, PN cl, PN self, PN block) {
int with_index = potion_arity(P, block) >= 2;
PN_TUPLE_EACH(self, i, v, {
if (with_index)
- PN_CLOSURE(block)->method(P, block, self, v, PN_NUM(i));
+ PN_CLOSURE(block)->method(P, block, P->lobby, v, PN_NUM(i));
else
- PN_CLOSURE(block)->method(P, block, self, v);
+ PN_CLOSURE(block)->method(P, block, P->lobby, v);
});
return self;
}

0 comments on commit 34c20e5

Please sign in to comment.