diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-08-10 11:13:49 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-08-10 11:13:49 +0200 |
commit | 25fd9e3c89108026be74136a61eff0a7e7a67ff9 (patch) | |
tree | a6f89b460710eb3309b4f45cc56ecefafafca0db /compiler | |
parent | 5d05ee21c217e3585bf2eec9158e7aff8236894b (diff) | |
download | Nim-25fd9e3c89108026be74136a61eff0a7e7a67ff9.tar.gz |
don't allow to pass a closure to spawn
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/lowerings.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/lowerings.nim b/compiler/lowerings.nim index cdea2a4ff..36eb24653 100644 --- a/compiler/lowerings.nim +++ b/compiler/lowerings.nim @@ -578,6 +578,8 @@ proc wrapProcForSpawn*(owner: PSym; spawnExpr: PNode; retType: PType; var fn = n.sons[0] # templates and macros are in fact valid here due to the nature of # 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, skMethod, skConverter}): # for indirect calls we pass the function pointer in the scratchObj |