allow () in more contexts

This commit is contained in:
Araq
2014-12-19 13:44:43 +01:00
parent 18cbd51600
commit d4230e052d

View File

@@ -77,7 +77,17 @@ macro `=>`*(p, b: expr): expr {.immediate.} =
identDefs.add(c)
identDefs.add(newEmptyNode())
identDefs.add(newEmptyNode())
of nnkInfix:
if c[0].kind == nnkIdent and c[0].ident == !"->":
var procTy = createProcType(c[1], c[2])
params[0] = procTy[0][0]
for i in 1 .. <procTy[0].len:
params.add(procTy[0][i])
else:
error("Expected proc type (->) got (" & $c[0].ident & ").")
break
else:
echo treeRepr c
error("Incorrect procedure parameter list.")
params.add(identDefs)
of nnkIdent: