This commit is contained in:
Yuichi Nishiwaki 2015-06-28 00:21:25 +09:00
parent c1478400cd
commit 62dbdb79dd
1 changed files with 2 additions and 10 deletions

View File

@ -345,23 +345,15 @@ search_scope(analyze_scope *scope, pic_sym *sym)
return kh_get(a, &scope->args, sym) != kh_end(&scope->args) || kh_get(a, &scope->locals, sym) != kh_end(&scope->locals) || scope->depth == 0;
}
static void
capture_var(pic_state *pic, analyze_scope *scope, pic_sym *sym)
{
int ret;
kh_put(a, &scope->captures, sym, &ret);
}
static int
find_var(pic_state *pic, analyze_scope *scope, pic_sym *sym)
{
int depth = 0;
int depth = 0, ret;
while (scope) {
if (search_scope(scope, sym)) {
if (depth > 0) {
capture_var(pic, scope, sym);
kh_put(a, &scope->captures, sym, &ret); /* capture! */
}
return depth;
}