summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-02-11 00:42:12 +0100
committerAraq <rumpf_a@web.de>2017-02-11 00:42:12 +0100
commit36d3fd64da21fe128f92ea49943c9dd834aa6848 (patch)
treeabb3261273ec70de718947617c2be8814c2b6a72 /compiler/semexprs.nim
parentc8ae7164e502b585843c584af65f78f67002830e (diff)
downloadNim-36d3fd64da21fe128f92ea49943c9dd834aa6848.tar.gz
fixes #5354
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r--compiler/semexprs.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 57674735a..9972585c7 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -1093,11 +1093,11 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
       return readTypeParameter(c, ty, i, n.info)
     of tyObject, tyTuple:
       if ty.n != nil and ty.n.kind == nkRecList:
-        for field in ty.n:
-          if field.sym.name == i:
-            n.typ = newTypeWithSons(c, tyFieldAccessor, @[ty, field.sym.typ])
-            n.typ.n = copyTree(n)
-            return n
+        let field = lookupInRecord(ty.n, i)
+        if field != nil:
+          n.typ = newTypeWithSons(c, tyFieldAccessor, @[ty, field.typ])
+          n.typ.n = copyTree(n)
+          return n
     else:
       # echo "TYPE FIELD ACCESS"
       # debug ty