From 2ee14a9301ea2ab5c6a32c2c82cb45784976bb81 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 26 Dec 2025 11:27:19 +0100 Subject: [PATCH] progress --- compiler/ast2nif.nim | 2 +- compiler/ccgstmts.nim | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/compiler/ast2nif.nim b/compiler/ast2nif.nim index d2e8f39d4c..7d6ca246f7 100644 --- a/compiler/ast2nif.nim +++ b/compiler/ast2nif.nim @@ -621,7 +621,7 @@ proc writeGlobal(w: var Writer; dest: var TokenBuf; n: PNode) = case n.kind of nkVarTuple: writeNode(w, dest, n) - of nkIdentDefs: + of nkIdentDefs, nkConstDef: # nkIdentDefs: [ident1, ident2, ..., type, default] # All children except the last two are identifiers for i in 0 ..< max(0, n.len - 2): diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index c2536fc432..7deaa18157 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -126,7 +126,7 @@ proc genVarTuple(p: BProc, n: PNode) = let vn = n[i] let v = vn.sym if sfCompileTime in v.flags: continue - ensureMutable v + backendEnsureMutable v if sfGlobal in v.flags: assignGlobalVar(p, vn, "") genObjectInit(p, cpsInit, v.typ, v.locImpl, constructObj) @@ -743,9 +743,10 @@ proc genBlock(p: BProc, n: PNode, d: var TLoc) = # named block? assert(n[0].kind == nkSym) var sym = n[0].sym - ensureMutable sym + backendEnsureMutable sym sym.locImpl.k = locOther - sym.position = p.breakIdx+1 + sym.positionImpl = p.breakIdx+1 + # ^ IC: review this expr(p, n[1], d) endSimpleBlock(p, scope) @@ -1258,7 +1259,7 @@ proc genTryCpp(p: BProc, t: PNode, d: var TLoc) = initElifBranch(p.s(cpsStmts), ifStmt, orExpr) if exvar != nil: fillLocalName(p, exvar.sym) - ensureMutable exvar.sym + backendEnsureMutable exvar.sym fillLoc(exvar.sym.locImpl, locTemp, exvar, OnStack) linefmt(p, cpsStmts, "$1 $2 = T$3_;$n", [getTypeDesc(p.module, exvar.sym.typ), rdLoc(exvar.sym.loc), rope(etmp+1)]) @@ -1307,7 +1308,7 @@ proc genTryCpp(p: BProc, t: PNode, d: var TLoc) = if isImportedException(typeNode.typ, p.config): let exvar = t[i][j][2] # ex1 in `except ExceptType as ex1:` fillLocalName(p, exvar.sym) - ensureMutable exvar.sym + backendEnsureMutable exvar.sym fillLoc(exvar.sym.locImpl, locTemp, exvar, OnStack) startBlockWith(p): lineCg(p, cpsStmts, "catch ($1& $2) {$n", [getTypeDesc(p.module, typeNode.typ), rdLoc(exvar.sym.loc)]) @@ -1399,7 +1400,7 @@ proc genTryCppOld(p: BProc, t: PNode, d: var TLoc) = if t[i][j].isInfixAs(): let exvar = t[i][j][2] # ex1 in `except ExceptType as ex1:` fillLocalName(p, exvar.sym) - ensureMutable exvar.sym + backendEnsureMutable exvar.sym fillLoc(exvar.sym.locImpl, locTemp, exvar, OnUnknown) startBlockWith(p): lineCg(p, cpsStmts, "catch ($1& $2) {$n", [getTypeDesc(p.module, t[i][j][1].typ), rdLoc(exvar.sym.loc)])