(cherry picked from commit ca9c74391a)
This commit is contained in:
Bung
2022-12-23 18:32:03 +08:00
committed by narimiran
parent c25621d153
commit 8155b8d3ce
2 changed files with 26 additions and 3 deletions

View File

@@ -687,9 +687,12 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
if v.kind == skLet and sfImportc notin v.flags:
localError(c.config, a.info, errLetNeedsInit)
if sfCompileTime in v.flags:
var x = newNodeI(result.kind, v.info)
x.add result[i]
vm.setupCompileTimeVar(c.module, c.idgen, c.graph, x)
if a.kind != nkVarTuple:
var x = newNodeI(result.kind, v.info)
x.add result[i]
vm.setupCompileTimeVar(c.module, c.idgen, c.graph, x)
else:
localError(c.config, a.info, "cannot destructure to compile time variable")
if v.flags * {sfGlobal, sfThread} == {sfGlobal}:
message(c.config, v.info, hintGlobalVar)
if {sfGlobal, sfPure} <= v.flags: