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/expr.zc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/compiler/expr.zc') diff --git a/src/compiler/expr.zc b/src/compiler/expr.zc index c6d29c6..40de6ef 100644 --- a/src/compiler/expr.zc +++ b/src/compiler/expr.zc @@ -1014,7 +1014,9 @@ int primary() { return C_PLAIN; } s = source_lookup(n); - if (mstruct && !ginst) { ms = lookup(methname(mstruct, n)); if (ms >= 0 && skind[ms] == K_CONST) s = ms; } + // in a method of a struct a bare name is that struct's own constant or static function first, so it + // wins over a global (a top-level function or constant) of the same name + if (mstruct && !ginst) { ms = lookup(methname(mstruct, n)); if (ms >= 0 && (skind[ms] == K_CONST || (skind[ms] == K_FN && (sflag[ms] & F_STATIC)))) s = ms; } if (s < 0 && rt.eq_w(n, "new")) s = source_lookup(s_new); if (s >= 0) rs_put(toff, RS_SYM, rs_sym(s), s); if (s >= 0 && skind[s] == K_KW) { -- cgit v1.2.3