add depth property

This commit is contained in:
Yuichi Nishiwaki 2014-01-23 16:17:52 +09:00
parent 6d346fef87
commit c7811f0c39
1 changed files with 2 additions and 0 deletions

View File

@ -82,6 +82,7 @@ valid_formal(pic_state *pic, pic_value formal)
} }
typedef struct analyze_scope { typedef struct analyze_scope {
int depth;
/* rest args variable is counted by localc */ /* rest args variable is counted by localc */
bool varg; bool varg;
size_t argc, localc; size_t argc, localc;
@ -181,6 +182,7 @@ push_scope(analyze_state *state, pic_value args)
scope = (analyze_scope *)pic_alloc(pic, sizeof(analyze_scope)); scope = (analyze_scope *)pic_alloc(pic, sizeof(analyze_scope));
scope->up = state->scope; scope->up = state->scope;
scope->depth = state->scope ? state->scope->depth + 1 : 0;
scope->local_tbl = x = xh_new(); scope->local_tbl = x = xh_new();
scope->dirty_flags = xh_new(); scope->dirty_flags = xh_new();
scope->varg = false; scope->varg = false;