summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-05-28 17:19:44 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-05-28 17:19:44 +0200
commita406ebbac9ef068a8a633076a9bace259ce53a1d (patch)
tree2a1c22d3a4fd9178b5d93f2d2939b864b90b1f13
parentd3fe4a2db15355f5830395a6f68ff8ec1c8a7a88 (diff)
downloadNim-a406ebbac9ef068a8a633076a9bace259ce53a1d.tar.gz
cleanup of #4113
-rw-r--r--compiler/vm.nim54
-rw-r--r--compiler/vmdeps.nim6
2 files changed, 30 insertions, 30 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index cddb57f17..f275b7b9b 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -1186,34 +1186,34 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       let rb = instr.regB
       let rc = instr.regC
       case rc:
-        of 0:
-          # getType opcode:
-          ensureKind(rkNode)
-          if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
-            regs[ra].node = opMapTypeToAst(regs[rb].node.typ, c.debug[pc])
-          else:
-            stackTrace(c, tos, pc, errGenerated, "node has no type")
-        of 1:
-          # typeKind opcode:
-          ensureKind(rkInt)
-          if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
-            regs[ra].intVal = ord(regs[rb].node.typ.kind)
-          #else:
-          #  stackTrace(c, tos, pc, errGenerated, "node has no type")
-        of 2:
-          # getTypeInst opcode:
-          ensureKind(rkNode)
-          if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
-            regs[ra].node = opMapTypeInstToAst(regs[rb].node.typ, c.debug[pc])
-          else:
-            stackTrace(c, tos, pc, errGenerated, "node has no type")
+      of 0:
+        # getType opcode:
+        ensureKind(rkNode)
+        if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
+          regs[ra].node = opMapTypeToAst(regs[rb].node.typ, c.debug[pc])
         else:
-          # getTypeImpl opcode:
-          ensureKind(rkNode)
-          if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
-            regs[ra].node = opMapTypeImplToAst(regs[rb].node.typ, c.debug[pc])
-          else:
-            stackTrace(c, tos, pc, errGenerated, "node has no type")
+          stackTrace(c, tos, pc, errGenerated, "node has no type")
+      of 1:
+        # typeKind opcode:
+        ensureKind(rkInt)
+        if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
+          regs[ra].intVal = ord(regs[rb].node.typ.kind)
+        #else:
+        #  stackTrace(c, tos, pc, errGenerated, "node has no type")
+      of 2:
+        # getTypeInst opcode:
+        ensureKind(rkNode)
+        if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
+          regs[ra].node = opMapTypeInstToAst(regs[rb].node.typ, c.debug[pc])
+        else:
+          stackTrace(c, tos, pc, errGenerated, "node has no type")
+      else:
+        # getTypeImpl opcode:
+        ensureKind(rkNode)
+        if regs[rb].kind == rkNode and regs[rb].node.typ != nil:
+          regs[ra].node = opMapTypeImplToAst(regs[rb].node.typ, c.debug[pc])
+        else:
+          stackTrace(c, tos, pc, errGenerated, "node has no type")
     of opcNStrVal:
       decodeB(rkNode)
       createStr regs[ra]
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim
index 5fef00257..e7ead17b6 100644
--- a/compiler/vmdeps.nim
+++ b/compiler/vmdeps.nim
@@ -88,7 +88,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
   template atomicType(name): expr = atomicTypeX(name, t, info)
   template mapTypeToAst(t,info): expr = mapTypeToAstX(t, info, inst)
   template mapTypeToAstR(t,info): expr = mapTypeToAstX(t, info, inst, true)
-  template mapTypeToAst(t,i,info): expr = 
+  template mapTypeToAst(t,i,info): expr =
     if i<t.len and t.sons[i]!=nil: mapTypeToAstX(t.sons[i], info, inst)
     else: ast.emptyNode
   template mapTypeToBracket(name,t,info): expr =
@@ -112,7 +112,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
       if allowRecursion:  # getTypeImpl behavior: turn off recursion
         allowRecursion = false
       else:  # getTypeInst behavior: return symbol
-        return atomicType(t.sym.name.s) 
+        return atomicType(t.sym.name.s)
 
   case t.kind
   of tyNone: result = atomicType("none")
@@ -125,7 +125,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
   of tyArrayConstr, tyArray:
     result = newNodeIT(nkBracketExpr, if t.n.isNil: info else: t.n.info, t)
     result.add atomicType("array")
-    if inst:
+    if inst and t.sons[0].kind == tyRange:
       var rng = newNodeX(nkInfix)
       rng.add newIdentNode(getIdent(".."), info)
       rng.add t.sons[0].n.sons[0].copyTree