summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-10-07 12:01:06 +0200
committerGitHub <noreply@github.com>2021-10-07 12:01:06 +0200
commit8eef55715725a9dba2ff0afbdbb564383f3a29a6 (patch)
tree6dd5c4c126e27d198fe621c95e168fa019556e36
parenteede2bfb5de30f7f411d9437e19f253f8dac629b (diff)
downloadNim-8eef55715725a9dba2ff0afbdbb564383f3a29a6.tar.gz
fixes a 'mixin' statement handling regression [backport:1.2] (#18968)
-rw-r--r--compiler/semtempl.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index eda4ca6cc..c10917bcb 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -110,9 +110,14 @@ proc semBindStmt(c: PContext, n: PNode, toBind: var IntSet): PNode =
 
 proc semMixinStmt(c: PContext, n: PNode, toMixin: var IntSet): PNode =
   result = copyNode(n)
+  var count = 0
   for i in 0..<n.len:
     toMixin.incl(considerQuotedIdent(c, n[i]).id)
-    result.add symChoice(c, n[i], nil, scForceOpen)
+    let x = symChoice(c, n[i], nil, scForceOpen)
+    inc count, x.len
+    result.add x
+  if count == 0:
+    result = newNodeI(nkEmpty, n.info)
 
 proc replaceIdentBySym(c: PContext; n: var PNode, s: PNode) =
   case n.kind