summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/semexprs.nim')
-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