get rid of redundant code in is_closed function
This commit is contained in:
parent
2f8b016d86
commit
82ea416c34
|
@ -754,15 +754,9 @@ pop_resolver_scope(resolver_state *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_closed(resolver_state *state, int depth, pic_sym sym)
|
is_closed(resolver_state *state, pic_sym sym)
|
||||||
{
|
{
|
||||||
resolver_scope *scope = state->scope;
|
return xh_get(state->scope->cvs, pic_symbol_name(state->pic, sym)) != NULL;
|
||||||
|
|
||||||
while (depth-- > 0) {
|
|
||||||
scope = scope->up;
|
|
||||||
}
|
|
||||||
|
|
||||||
return xh_get(scope->cvs, pic_symbol_name(state->pic, sym)) != NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
|
@ -851,7 +845,7 @@ resolve_reference_node(resolver_state *state, pic_value obj)
|
||||||
if (depth == scope->depth) {
|
if (depth == scope->depth) {
|
||||||
return resolve_gref(state, sym);
|
return resolve_gref(state, sym);
|
||||||
}
|
}
|
||||||
else if (depth == 0 && is_closed(state, depth, sym)) {
|
else if (depth == 0 && is_closed(state, sym)) {
|
||||||
return resolve_lref(state, sym);
|
return resolve_lref(state, sym);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue