summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-04-11 02:28:06 +0200
committerAraq <rumpf_a@web.de>2015-04-11 10:01:10 +0200
commitd89a20cc1d1ddc497807825c1a80597630e7fa63 (patch)
tree1eb86a6251455feed5210df2272e360a04a83c4b /compiler
parent670367e13b5310f627bb114973d7f99d4942bcc8 (diff)
downloadNim-d89a20cc1d1ddc497807825c1a80597630e7fa63.tar.gz
fixes #2509
Diffstat (limited to 'compiler')
-rw-r--r--compiler/renderer.nim1
-rw-r--r--compiler/seminst.nim5
-rw-r--r--compiler/sempass2.nim2
-rw-r--r--compiler/semtypinst.nim8
4 files changed, 14 insertions, 2 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim
index ce818e3cd..ffdb60696 100644
--- a/compiler/renderer.nim
+++ b/compiler/renderer.nim
@@ -503,6 +503,7 @@ proc gsub(g: var TSrcGen, n: PNode) =
 
 proc hasCom(n: PNode): bool =
   result = false
+  if n.isNil: return false
   if n.comment != nil: return true
   case n.kind
   of nkEmpty..nkNilLit: discard
diff --git a/compiler/seminst.nim b/compiler/seminst.nim
index dc36ecf34..f72e2dc5b 100644
--- a/compiler/seminst.nim
+++ b/compiler/seminst.nim
@@ -176,7 +176,9 @@ proc instantiateProcType(c: PContext, pt: TIdTable,
 
   for i in 1 .. <result.len:
     # twrong_field_caching requires these 'resetIdTable' calls:
-    if i > 1: resetIdTable(cl.symMap)
+    if i > 1:
+      resetIdTable(cl.symMap)
+      resetIdTable(cl.localCache)
     result.sons[i] = replaceTypeVarsT(cl, result.sons[i])
     propagateToOwner(result, result.sons[i])
     internalAssert originalParams[i].kind == nkSym
@@ -196,6 +198,7 @@ proc instantiateProcType(c: PContext, pt: TIdTable,
       addDecl(c, result.n.sons[i].sym)
 
   resetIdTable(cl.symMap)
+  resetIdTable(cl.localCache)
   result.sons[0] = replaceTypeVarsT(cl, result.sons[0])
   result.n.sons[0] = originalParams[0].copyTree
 
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 6928dbaf4..5a243afa0 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -764,7 +764,7 @@ proc track(tracked: PEffects, n: PNode) =
     setLen(tracked.locked, oldLocked)
     tracked.currLockLevel = oldLockLevel
   of nkTypeSection, nkProcDef, nkConverterDef, nkMethodDef, nkIteratorDef,
-      nkMacroDef, nkTemplateDef:
+      nkMacroDef, nkTemplateDef, nkLambda, nkDo:
     discard
   else:
     for i in 0 .. <safeLen(n): track(tracked, n.sons[i])
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim
index cbd7999c7..914b92fc8 100644
--- a/compiler/semtypinst.nim
+++ b/compiler/semtypinst.nim
@@ -418,15 +418,23 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
     result = t
 
   of tyGenericInst:
+    result = PType(idTableGet(cl.localCache, t))
+    if result != nil: return result
     result = instCopyType(cl, t)
+    idTablePut(cl.localCache, t, result)
     for i in 1 .. <result.sonsLen:
       result.sons[i] = replaceTypeVarsT(cl, result.sons[i])
     propagateToOwner(result, result.lastSon)
 
   else:
     if containsGenericType(t):
+      #if not cl.allowMetaTypes:
+      result = PType(idTableGet(cl.localCache, t))
+      if result != nil: return result
       result = instCopyType(cl, t)
       result.size = -1 # needs to be recomputed
+      #if not cl.allowMetaTypes:
+      idTablePut(cl.localCache, t, result)
 
       for i in countup(0, sonsLen(result) - 1):
         if result.sons[i] != nil:
t.com> 2009-12-18 01:20:43 +0100 added provisional filesystem operations (cp/cut/paste/delete/mkdir)' href='/akspecs/ranger/commit/ranger/container/environment.py?h=v1.9.3&id=6a5d09b8731414c6fd76213bd31f7b29b847a235'>6a5d09b8 ^
65cb1a32 ^
f8e96a97 ^
9506fb8e ^

871c502d ^
6a5d09b8 ^
65cb1a32 ^
9506fb8e ^
3547d300 ^






871c502d ^


9506fb8e ^
728fb838 ^
ea87d005 ^
67bb838c ^



5645f266 ^
9506fb8e ^

728fb838 ^
5645f266 ^
ea87d005 ^
9506fb8e ^
1f62d7db ^


b4b0eb24 ^
1f62d7db ^

9506fb8e ^





1f62d7db ^







dd7a4f63 ^
1f62d7db ^
419e4aa5 ^

dd7a4f63 ^
1f62d7db ^
871c502d ^

728fb838 ^
3de15ddd ^
871c502d ^


6ae68da4 ^
871c502d ^
ea87d005 ^
3201b163 ^
766a5b6a ^

3201b163 ^
ea87d005 ^
9506fb8e ^
728fb838 ^
3d566884 ^
9506fb8e ^


3201b163 ^


ea87d005 ^
a1274aba ^



9506fb8e ^
89660a64 ^
728fb838 ^
dd7a4f63 ^

419e4aa5 ^

dd7a4f63 ^

5599636d ^
419e4aa5 ^
ea87d005 ^
581cce8c ^
766a5b6a ^

581cce8c ^
45cb587d ^
728fb838 ^
4162b636 ^
871c502d ^
45cb587d ^

728fb838 ^
4162b636 ^
cc952d63 ^

9506fb8e ^
419e4aa5 ^
9506fb8e ^
e48e3c5c ^


3ea48208 ^
766a5b6a ^
3ea48208 ^


9506fb8e ^
766a5b6a ^
b8dda85b ^
9506fb8e ^
766a5b6a ^
9506fb8e ^








3d566884 ^
9506fb8e ^


89660a64 ^
dd7a4f63 ^
9506fb8e ^
876e288a ^

766a5b6a ^

419e4aa5 ^
45cb587d ^
766a5b6a ^
45cb587d ^
3ea48208 ^
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197