fix #14314 do not analyze importc procs for effects (#14319)

This commit is contained in:
Timothee Cour 2020-05-12 07:19:03 -07:00 • committed by GitHub
commit de74362213
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 7 deletions

View file

@ -1151,12 +1151,17 @@ proc initEffects(g: ModuleGraph; effects: PNode; s: PSym; t: var TEffects; c: PC
t.config = g.config
t.c = c
proc hasRealBody(s: PSym): bool =
## also handles importc procs with runnableExamples, which requires `=`,
## which is not a real implementation, refs #14314
result = {sfForward, sfImportc} * s.flags == {}
proc trackProc*(c: PContext; s: PSym, body: PNode) =
let g = c.graph
var effects = s.typ.n[0]
if effects.kind != nkEffectList: return
# effects already computed?
if sfForward in s.flags: return
if not s.hasRealBody: return
if effects.len == effectListLen: return
var t: TEffects