diff options
author | Neelesh Chandola <neelesh.chandola@outlook.com> | 2019-01-22 12:25:11 +0530 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-01-22 07:55:11 +0100 |
commit | 226c15499fe829d533b4811aa5c68b15de870b04 (patch) | |
tree | b6f7b1eb4012a97feea6c4243931b147673e9218 /compiler/semstmts.nim | |
parent | 44c04b35717336595dad03ac532ee9e141a0e374 (diff) | |
download | Nim-226c15499fe829d533b4811aa5c68b15de870b04.tar.gz |
Fix compileTime pragma applying to whole var/let section (#10389)
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 288820d86..17f88d039 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -432,7 +432,6 @@ proc setVarType(c: PContext; v: PSym, typ: PType) = proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = var b: PNode result = copyNode(n) - var hasCompileTime = false for i in countup(0, sonsLen(n)-1): var a = n.sons[i] if c.config.cmd == cmdIdeTools: suggestStmt(c, a) @@ -556,13 +555,12 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = else: v.typ = tup b.sons[j] = newSymNode(v) checkNilable(c, v) - if sfCompileTime in v.flags: hasCompileTime = true + if sfCompileTime in v.flags: + var x = newNodeI(result.kind, v.info) + addSon(x, result[i]) + vm.setupCompileTimeVar(c.module, c.graph, x) if v.flags * {sfGlobal, sfThread} == {sfGlobal}: message(c.config, v.info, hintGlobalVar) - if hasCompileTime: - vm.setupCompileTimeVar(c.module, c.graph, result) - # handled by the VM codegen: - #c.graph.recordStmt(c.graph, c.module, result) proc semConst(c: PContext, n: PNode): PNode = result = copyNode(n) |