From f67be92512741c0472266bbb91f7d1acaa67e178 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 19 Jun 2019 09:54:01 +0200 Subject: [PATCH] [feature] cleanup PR, refs #11424 --- compiler/semexprs.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 558b450da9..e99c6172f5 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