aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/types.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 10:42:28 +0000
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 10:42:28 +0000
commitea052eab91b304459ddf64281fc93fc152597412 (patch)
tree8dcd378d6634626dd2529c2aef684890999de963 /src/compiler/types.zc
parenttodo: the spec verifier restarted from the first agent's partial work (diff)
parentfix std hover, full capture terminator, bare static calls, void main in run-o... (diff)
Merge four small fixes: std hovers, capture terminator, bare static calls, void main; todo updated
Diffstat (limited to 'src/compiler/types.zc')
-rw-r--r--src/compiler/types.zc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/types.zc b/src/compiler/types.zc
index c643f0b..6dda110 100644
--- a/src/compiler/types.zc
+++ b/src/compiler/types.zc
@@ -497,8 +497,9 @@ int dtype() {
}
return 0;
}
-// the struct whose body or methods are being compiled, when it declares constants: a bare
-// name there is looked up as Struct.name before the global scope
+// the struct whose body or methods are being compiled: a bare name there is looked up as Struct.name
+// (a constant, or a static function called by its bare name) before the global scope, so the struct's
+// own wins over a global of the same name
char* mstruct;
// does a constant declaration start in a struct body? const NAME = e; const T NAME = e;
// (a field of a const type has no initializer, so the = tells them apart)
@@ -652,6 +653,7 @@ int kw_struct() {
}
accept(s_semi);
i = 0;
+ if (!gen) mstruct = n;
while (i < nm) { fn_method_compile = 1; methdef(n, mn[i], mq[i], mst[i], mty[i], mrt[i], mrg[i]); fn_method_compile = 0; i++; }
mdg = 0;
mstruct = msv;