add commentary to lambda analyzer to avoid regression

This commit is contained in:
Yuichi Nishiwaki 2014-03-21 08:20:33 +09:00
parent b6b47943bb
commit 91065a7c25
1 changed files with 7 additions and 6 deletions

View File

@ -439,24 +439,25 @@ analyze_lambda(analyze_state *state, pic_value obj)
size_t i; size_t i;
xh_iter it; xh_iter it;
body = analyze(state, pic_cons(pic, pic_sym_value(pic->sBEGIN), pic_list_tail(pic, obj, 2)), true);
args = pic_nil_value(); args = pic_nil_value();
for (i = scope->args.size; i > 0; --i) { for (i = scope->args.size; i > 0; --i) {
var = xv_get(&scope->args, i - 1); var = xv_get(&scope->args, i - 1);
pic_push(pic, pic_sym_value(*var), args); pic_push(pic, pic_sym_value(*var), args);
} }
varg = scope->varg
? pic_true_value()
: pic_false_value();
/* To know what kind of local variables are defined, analyze body at first. */
body = analyze(state, pic_cons(pic, pic_sym_value(pic->sBEGIN), pic_list_tail(pic, obj, 2)), true);
locals = pic_nil_value(); locals = pic_nil_value();
for (i = scope->locals.size; i > 0; --i) { for (i = scope->locals.size; i > 0; --i) {
var = xv_get(&scope->locals, i - 1); var = xv_get(&scope->locals, i - 1);
pic_push(pic, pic_sym_value(*var), locals); pic_push(pic, pic_sym_value(*var), locals);
} }
varg = scope->varg
? pic_true_value()
: pic_false_value();
captures = pic_nil_value(); captures = pic_nil_value();
for (xh_begin(scope->captures, &it); ! xh_isend(&it); xh_next(&it)) { for (xh_begin(scope->captures, &it); ! xh_isend(&it); xh_next(&it)) {
if (it.e->val == CAPTURED) { if (it.e->val == CAPTURED) {