diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2019-01-22 07:35:52 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-01-22 07:35:52 +0100 |
commit | 3ea099bc7f75d35ee127932208d9d012b57f11f8 (patch) | |
tree | f9d87213df74cf6411f360c925fce44bc3eeae8e /compiler/semmagic.nim | |
parent | 7a3f382517cfc0f2b676dc6704b423e7b167b565 (diff) | |
download | Nim-3ea099bc7f75d35ee127932208d9d012b57f11f8.tar.gz |
Finalizer proc must be global (#10388)
Fixes #10376
Diffstat (limited to 'compiler/semmagic.nim')
-rw-r--r-- | compiler/semmagic.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index 05c8b181c..2311136b4 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -410,4 +410,9 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode, result = n else: result = plugin(c, n) + of mNewFinalize: + # Make sure the finalizer procedure refers to a procedure + if n[^1].kind == nkSym and n[^1].sym.kind notin {skProc, skFunc}: + localError(c.config, n.info, "finalizer must be a direct reference to a procedure") + result = n else: result = n |