diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-08-08 23:08:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-08 23:08:34 +0200 |
commit | 2a8bf470af995f4e7d5bb8a0f49bb2226f95c311 (patch) | |
tree | 271658b5a812b6c330362be5c91dd437abf269e3 | |
parent | 0bc8dd0b0065534b2dfab53b1844a9f6cc36844e (diff) | |
download | Nim-2a8bf470af995f4e7d5bb8a0f49bb2226f95c311.tar.gz |
fixes #15101 [backport] (#15171)
-rw-r--r-- | compiler/semfields.nim | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/semfields.nim b/compiler/semfields.nim index a911ae823..cea084d3a 100644 --- a/compiler/semfields.nim +++ b/compiler/semfields.nim @@ -23,7 +23,7 @@ proc instFieldLoopBody(c: TFieldInstCtx, n: PNode, forLoop: PNode): PNode = result = newNode(nkEmpty) return case n.kind - of nkEmpty..pred(nkIdent), succ(nkSym)..nkNilLit: result = n + of nkEmpty..pred(nkIdent), succ(nkSym)..nkNilLit: result = copyNode(n) of nkIdent, nkSym: result = n let ident = considerQuotedIdent(c.c, n) @@ -52,8 +52,7 @@ proc instFieldLoopBody(c: TFieldInstCtx, n: PNode, forLoop: PNode): PNode = if n.kind == nkContinueStmt: localError(c.c.config, n.info, "'continue' not supported in a 'fields' loop") - result = copyNode(n) - newSons(result, n.len) + result = shallowCopy(n) for i in 0..<n.len: result[i] = instFieldLoopBody(c, n[i], forLoop) |