summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-20 18:50:17 +0100
committerAraq <rumpf_a@web.de>2015-02-20 20:01:24 +0100
commitaef7be2e79831f4cdbd3292a7c5060e403bbff5e (patch)
tree62318c40205a4e74af32a7d9b3a0e973938bb473 /compiler
parent540f66cb096077ea377d7184d7d74bb15df023bf (diff)
downloadNim-aef7be2e79831f4cdbd3292a7c5060e403bbff5e.tar.gz
fixes #1902
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semfields.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/semfields.nim b/compiler/semfields.nim
index 823bef225..8d01a85d5 100644
--- a/compiler/semfields.nim
+++ b/compiler/semfields.nim
@@ -19,12 +19,13 @@ type
 
 proc instFieldLoopBody(c: TFieldInstCtx, n: PNode, forLoop: PNode): PNode =
   case n.kind
-  of nkEmpty..pred(nkIdent), succ(nkIdent)..nkNilLit: result = n
-  of nkIdent:
+  of nkEmpty..pred(nkIdent), succ(nkSym)..nkNilLit: result = n
+  of nkIdent, nkSym:
     result = n
+    let ident = considerQuotedIdent(n)
     var L = sonsLen(forLoop)
     if c.replaceByFieldName:
-      if n.ident.id == forLoop[0].ident.id:
+      if ident.id == considerQuotedIdent(forLoop[0]).id:
         let fieldName = if c.tupleType.isNil: c.field.name.s
                         elif c.tupleType.n.isNil: "Field" & $c.tupleIndex
                         else: c.tupleType.n.sons[c.tupleIndex].sym.name.s
@@ -32,7 +33,7 @@ proc instFieldLoopBody(c: TFieldInstCtx, n: PNode, forLoop: PNode): PNode =
         return
     # other fields:
     for i in ord(c.replaceByFieldName)..L-3:
-      if n.ident.id == forLoop[i].ident.id:
+      if ident.id == considerQuotedIdent(forLoop[i]).id:
         var call = forLoop.sons[L-2]
         var tupl = call.sons[i+1-ord(c.replaceByFieldName)]
         if c.field.isNil: