don't allow to pass a closure to spawn
This commit is contained in:
parent
5d05ee21c2
commit
25fd9e3c89
1 changed files with 2 additions and 0 deletions
|
|
@ -578,6 +578,8 @@ proc wrapProcForSpawn*(owner: PSym; spawnExpr: PNode; retType: PType;
|
||||||
var fn = n.sons[0]
|
var fn = n.sons[0]
|
||||||
# templates and macros are in fact valid here due to the nature of
|
# templates and macros are in fact valid here due to the nature of
|
||||||
# the transformation:
|
# the transformation:
|
||||||
|
if fn.kind == nkClosure:
|
||||||
|
localError(n.info, "closure in spawn environment is not allowed")
|
||||||
if not (fn.kind == nkSym and fn.sym.kind in {skProc, skTemplate, skMacro,
|
if not (fn.kind == nkSym and fn.sym.kind in {skProc, skTemplate, skMacro,
|
||||||
skMethod, skConverter}):
|
skMethod, skConverter}):
|
||||||
# for indirect calls we pass the function pointer in the scratchObj
|
# for indirect calls we pass the function pointer in the scratchObj
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue