feat: multi-instance closures, richer stdlib, and Rust-style diagnostics
Introduce fat function pointers (BuxFn {code, env}) so capturing closures
are heap-allocated per value in both bootstrap and selfhost. Expand
Array/Map/Set/String/Test/Result APIs, add proper tuple codegen and
error snippets with multi-char underlines, golden diagnostic tests, and
LSP diagnostics via buxc check.
This commit is contained in:
@@ -660,11 +660,15 @@ proc parsePostfix(p: var Parser): Expr =
|
||||
discard p.expect(tkRBracket, "expected ']' to close index")
|
||||
left = Expr(kind: ekIndex, loc: loc, exprIndexObj: left, exprIndexIdx: idx, exprIndexBoundsCheck: false)
|
||||
of tkDot:
|
||||
# Field expression or .await
|
||||
# Field expression, tuple index (.0, .1), or .await
|
||||
discard p.advance()
|
||||
if p.check(tkAwait):
|
||||
discard p.advance()
|
||||
left = Expr(kind: ekAwait, loc: loc, exprAwaitOperand: left)
|
||||
elif p.check(tkIntLiteral):
|
||||
# Tuple element access: t.0 → field "_0"
|
||||
let idxText = p.advance().text
|
||||
left = Expr(kind: ekField, loc: loc, exprFieldObj: left, exprFieldName: "_" & idxText)
|
||||
else:
|
||||
let fieldName = p.expectIdentOrKeyword("expected field name after '.'").text
|
||||
left = Expr(kind: ekField, loc: loc, exprFieldObj: left, exprFieldName: fieldName)
|
||||
|
||||
Reference in New Issue
Block a user