[refactor] add analyze_declare

This commit is contained in:
Yuichi Nishiwaki 2014-03-28 11:48:26 +09:00
parent e2741f8580
commit e47bd63762
1 changed files with 9 additions and 4 deletions

View File

@ -344,6 +344,14 @@ analyze_var(analyze_state *state, pic_value obj)
}
}
static pic_value
analyze_declare(analyze_state *state, pic_sym var)
{
define_var(state, var);
return analyze_var(state, pic_sym_value(var));
}
static pic_value
analyze_define(analyze_state *state, pic_value obj)
{
@ -364,10 +372,7 @@ analyze_define(analyze_state *state, pic_value obj)
} else {
sym = pic_sym(var);
}
define_var(state, sym);
var = analyze(state, var, false);
var = analyze_declare(state, sym);
if (pic_pair_p(pic_list_ref(pic, obj, 1))) {
val = pic_cons(pic, pic_symbol_value(pic->sLAMBDA),