diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-08-11 14:50:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 14:50:46 +0200 |
commit | 813f16a2a39f1375b241cf50845f641ea44d890e (patch) | |
tree | a5c45d5ead15167ded8d9d9dcef87dbf52013a38 /compiler/lambdalifting.nim | |
parent | 963db9e7dac39f4238f013addfae36439318b67f (diff) | |
parent | b022576ce96f5c166c7f5684bef9de682704cb1b (diff) | |
download | Nim-813f16a2a39f1375b241cf50845f641ea44d890e.tar.gz |
Fix #8473 (#15169)
* Make explicit {.nimcall.} a seperate calling convention * Add testcase for #5688 * Fix bootstrapping * Remove little lies :) * Use typeflag instead
Diffstat (limited to 'compiler/lambdalifting.nim')
-rw-r--r-- | compiler/lambdalifting.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index c1cd07583..c23ca52cb 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -293,7 +293,7 @@ proc markAsClosure(g: ModuleGraph; owner: PSym; n: PNode) = ("'$1' is of type <$2> which cannot be captured as it would violate memory" & " safety, declared here: $3; using '-d:nimWorkaround14447' helps in some cases") % [s.name.s, typeToString(s.typ), g.config$s.info]) - elif owner.typ.callConv notin {ccClosure, ccDefault}: + elif not (owner.typ.callConv == ccClosure or owner.typ.callConv == ccNimCall and tfExplicitCallConv notin owner.typ.flags): localError(g.config, n.info, "illegal capture '$1' because '$2' has the calling convention: <$3>" % [s.name.s, owner.name.s, CallingConvToStr[owner.typ.callConv]]) incl(owner.typ.flags, tfCapturesEnv) @@ -822,7 +822,8 @@ proc semCaptureSym*(s, owner: PSym) = var o = owner.skipGenericOwner while o != nil and o.kind != skModule: if s.owner == o: - if owner.typ.callConv in {ccClosure, ccDefault} or owner.kind == skIterator: + if owner.typ.callConv == ccClosure or owner.kind == skIterator or + owner.typ.callConv == ccNimCall and tfExplicitCallConv notin owner.typ.flags: owner.typ.callConv = ccClosure propagateClosure(owner.skipGenericOwner, s.owner) else: |