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
t;rumpf_a@web.de> 2013-07-29 22:56:32 +0200 committer Araq <rumpf_a@web.de> 2013-07-29 22:56:32 +0200 'nimrod pretty' command: next steps' href='/ahoang/Nim/commit/compiler/pretty.nim?h=devel&id=6810a0e3e3f82ca40ca4fc51de820212dc90610d'>6810a0e3e ^
ef975d277 ^
6810a0e3e ^




fd2a80826 ^
28ad262a4 ^

6810a0e3e ^





















ef975d277 ^






6810a0e3e ^
ef975d277 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147