Don't leak sem PContext into transf

This commit is contained in:
Yuriy Glukhov 2018-05-01 10:31:49 +03:00
commit 48d8e215d5
3 changed files with 9 additions and 10 deletions

View file

@ -20,10 +20,9 @@
import
intsets, strutils, options, ast, astalgo, trees, treetab, msgs, os, lookups,
idents, renderer, types, passes, semfold, magicsys, cgmeth, rodread, semdata,
idents, renderer, types, passes, semfold, magicsys, cgmeth, rodread,
lambdalifting, sempass2, lowerings, destroyer, liftlocals, closureiters
type
PTransNode* = distinct PNode
@ -968,11 +967,11 @@ template liftDefer(c, root) =
if c.deferDetected:
liftDeferAux(root)
proc transformBody*(ctx: PContext, n: PNode, prc: PSym): PNode =
proc transformBody*(module: PSym, features: set[Feature], n: PNode, prc: PSym): PNode =
result = n
if nfTransf notin n.flags and prc.kind notin {skTemplate}:
var c = openTransf(ctx.module, "")
result = liftLambdas(ctx.features, prc, result, c.tooEarly)
var c = openTransf(module, "")
result = liftLambdas(features, prc, result, c.tooEarly)
result = processTransf(c, result, prc)
liftDefer(c, result)
@ -981,7 +980,7 @@ proc transformBody*(ctx: PContext, n: PNode, prc: PSym): PNode =
if c.needsDestroyPass: #and newDestructors:
result = injectDestructorCalls(prc, result)
if prc.isIterator and oldIterTransf notin ctx.features:
if prc.isIterator and oldIterTransf notin features:
result = transformClosureIterator(prc, result)
incl(result.flags, nfTransf)