summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorClay Sweetser <clay.sweetser@gmail.com>2013-11-14 12:32:35 -0500
committerClay Sweetser <clay.sweetser@gmail.com>2013-11-18 17:26:53 -0500
commitf279d465d0a9499825efba93ee189b5cc279e064 (patch)
treede17faf26f05507df1886611cebeb4eb132e4a38 /compiler/semstmts.nim
parent9061b8961eb5cefd31eba9314a5932f35f524eac (diff)
downloadNim-f279d465d0a9499825efba93ee189b5cc279e064.tar.gz
Prevent lambdas from crashing if given implicit generic parameters.
Fixes issues #599 and #641 (and possibly other generic-related issues)
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index ed6787a16..3752739bf 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -879,8 +879,9 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode =
   openScope(c)
   if n.sons[genericParamsPos].kind != nkEmpty:
     illFormedAst(n)           # process parameters:
-  if n.sons[paramsPos].kind != nkEmpty: 
-    semParamList(c, n.sons[ParamsPos], nil, s)
+  if n.sons[paramsPos].kind != nkEmpty:
+    var gp = newNodeI(nkGenericParams, n.info)
+    semParamList(c, n.sons[ParamsPos], gp, s)
     ParamsTypeCheck(c, s.typ)
   else:
     s.typ = newTypeS(tyProc, c)
='#n149'>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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227