diff options
| author | gingerBill <bill@gingerbill.org> | 2020-12-04 11:28:14 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-12-04 11:28:14 +0000 |
| commit | 05a3bdad588d7d1194d4705b4f60506208e36b39 (patch) | |
| tree | 21b20160e6b1c8200b4b02e47a10d4139c65538c /src/check_expr.cpp | |
| parent | 0ef02e6737ffc382a00fc549811e9fca49bd4089 (diff) | |
Allow nested procedures to access `@(static)` and `@(thread_local)` variables
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 8e09c0320..ea460ce09 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1075,8 +1075,10 @@ Entity *check_ident(CheckerContext *c, Operand *o, Ast *n, Type *named_type, Typ if (e->parent_proc_decl != nullptr && e->parent_proc_decl != c->curr_proc_decl) { if (e->kind == Entity_Variable) { - error(n, "Nested procedures do not capture its parent's variables: %.*s", LIT(name)); - return nullptr; + if ((e->flags & EntityFlag_Static) == 0) { + error(n, "Nested procedures do not capture its parent's variables: %.*s", LIT(name)); + return nullptr; + } } else if (e->kind == Entity_Label) { error(n, "Nested procedures do not capture its parent's labels: %.*s", LIT(name)); return nullptr; |