summaryrefslogtreecommitdiffhomepage
path: root/compiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler.c b/compiler.c
index db8917b..70d15d6 100644
--- a/compiler.c
+++ b/compiler.c
@@ -790,10 +790,22 @@ uc_compiler_add_upval(uc_compiler_t *compiler, size_t idx, bool local, uc_value_
static ssize_t
uc_compiler_resolve_upval(uc_compiler_t *compiler, uc_value_t *name, bool *constant)
{
+ uc_upvals_t *upvals = &compiler->upvals;
+ uc_upval_t *uv;
ssize_t idx;
+ size_t i;
+
+ if (!compiler->parent) {
+ for (i = 0, uv = upvals->entries; i < upvals->count; i++, uv = upvals->entries + i) {
+ if (ucv_is_equal(uv->name, name) && uv->local == false) {
+ *constant = uv->constant;
+
+ return i;
+ }
+ }
- if (!compiler->parent)
return -1;
+ }
idx = uc_compiler_resolve_local(compiler->parent, name, constant);