proc arguments are in scope when the result type definition is being processed

This is intended for type deduction depending on the arguments
proc foo(x: type): type(expr(x))
This commit is contained in:
Zahary Karadjov 2011-12-09 15:56:48 +02:00
commit de4b894541
5 changed files with 16 additions and 5 deletions

View file

@ -135,7 +135,8 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
if n.sons[paramsPos].kind != nkEmpty:
removeDefaultParamValues(n.sons[ParamsPos])
semParamList(c, n.sons[ParamsPos], nil, result)
addParams(c, result.typ.n)
# XXX: obsoleted - happens in semParamList #
# addParams(c, result.typ.n)
else:
result.typ = newTypeS(tyProc, c)
addSon(result.typ, nil)