summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-06-19 09:54:01 +0200
committerAraq <rumpf_a@web.de>2019-06-19 09:54:01 +0200
commitf67be92512741c0472266bbb91f7d1acaa67e178 (patch)
tree91055ef59641f2501b0c98612c56d9a49530b421
parent296c48de5e502f61f8f969c64a8c364bfe1ee0bc (diff)
downloadNim-f67be92512741c0472266bbb91f7d1acaa67e178.tar.gz
[feature] cleanup PR, refs #11424
-rw-r--r--compiler/semexprs.nim11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 558b450da..e99c6172f 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -541,11 +541,12 @@ proc semArrayConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
       if not isOrdinalType(idx.typ):
         localError(c.config, idx.info, "expected ordinal value for array " &
                    "index, got '$1'" % renderTree(idx))
-      firstIndex = getOrdValue(idx)
-      lastIndex = firstIndex
-      indexType = idx.typ
-      lastValidIndex = lastOrd(c.config, indexType)
-      x = x.sons[1]
+      else:
+        firstIndex = getOrdValue(idx)
+        lastIndex = firstIndex
+        indexType = idx.typ
+        lastValidIndex = lastOrd(c.config, indexType)
+        x = x.sons[1]
 
     let yy = semExprWithType(c, x)
     var typ = yy.typ