From 93340f97dce404a008f489729df144ace53528ab Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 10:38:17 +0000 Subject: fix std hover, full capture terminator, bare static calls, void main in run-only images - hover: a symbol from an embedded library source (tinyvm:std.zc, tinyvm:icon.zc) was looked up only in the document; look it up by its qualified name in the library source (hover_embedded_sym), and render a method found that way by its line (bs_hover). - std.capture: allocate one word more than the 256 it holds, so end() terminates inside the buffer. - a bare call to a static function of the enclosing struct resolves like a bare struct constant (mstruct is set for every non-generic struct's methods); the struct's own wins over a global. - run.zc declares main untyped (fn main();), so a run-only image accepts int, void or untyped main with both compilers. --- src/compiler/types.zc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/compiler/types.zc') 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; -- cgit v1.2.3