This commit is contained in:
parent
ac982d8a96
commit
9afb466d73
3 changed files with 6 additions and 6 deletions
|
|
@ -859,7 +859,7 @@ proc liftIterToProc*(g: ModuleGraph; fn: PSym; body: PNode; ptrType: PType;
|
||||||
fn.typ.callConv = oldCC
|
fn.typ.callConv = oldCC
|
||||||
|
|
||||||
proc liftLambdas*(g: ModuleGraph; fn: PSym, body: PNode; tooEarly: var bool;
|
proc liftLambdas*(g: ModuleGraph; fn: PSym, body: PNode; tooEarly: var bool;
|
||||||
idgen: IdGenerator): PNode =
|
idgen: IdGenerator, force: bool): PNode =
|
||||||
# XXX backend == backendJs does not suffice! The compiletime stuff needs
|
# XXX backend == backendJs does not suffice! The compiletime stuff needs
|
||||||
# the transformation even when compiling to JS ...
|
# the transformation even when compiling to JS ...
|
||||||
|
|
||||||
|
|
@ -868,7 +868,7 @@ proc liftLambdas*(g: ModuleGraph; fn: PSym, body: PNode; tooEarly: var bool;
|
||||||
|
|
||||||
if body.kind == nkEmpty or (
|
if body.kind == nkEmpty or (
|
||||||
g.config.backend == backendJs and not isCompileTime) or
|
g.config.backend == backendJs and not isCompileTime) or
|
||||||
fn.skipGenericOwner.kind != skModule:
|
(fn.skipGenericOwner.kind != skModule and not force):
|
||||||
|
|
||||||
# ignore forward declaration:
|
# ignore forward declaration:
|
||||||
result = body
|
result = body
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ type
|
||||||
TransformBodyFlag* = enum
|
TransformBodyFlag* = enum
|
||||||
dontUseCache, useCache
|
dontUseCache, useCache
|
||||||
|
|
||||||
proc transformBody*(g: ModuleGraph; idgen: IdGenerator, prc: PSym, flag: TransformBodyFlag): PNode
|
proc transformBody*(g: ModuleGraph; idgen: IdGenerator, prc: PSym, flag: TransformBodyFlag, force = false): PNode
|
||||||
|
|
||||||
import closureiters, lambdalifting
|
import closureiters, lambdalifting
|
||||||
|
|
||||||
|
|
@ -1145,7 +1145,7 @@ template liftDefer(c, root) =
|
||||||
if c.deferDetected:
|
if c.deferDetected:
|
||||||
liftDeferAux(root)
|
liftDeferAux(root)
|
||||||
|
|
||||||
proc transformBody*(g: ModuleGraph; idgen: IdGenerator; prc: PSym; flag: TransformBodyFlag): PNode =
|
proc transformBody*(g: ModuleGraph; idgen: IdGenerator; prc: PSym; flag: TransformBodyFlag, force = false): PNode =
|
||||||
assert prc.kind in routineKinds
|
assert prc.kind in routineKinds
|
||||||
|
|
||||||
if prc.transformedBody != nil:
|
if prc.transformedBody != nil:
|
||||||
|
|
@ -1155,7 +1155,7 @@ proc transformBody*(g: ModuleGraph; idgen: IdGenerator; prc: PSym; flag: Transfo
|
||||||
else:
|
else:
|
||||||
prc.transformedBody = newNode(nkEmpty) # protects from recursion
|
prc.transformedBody = newNode(nkEmpty) # protects from recursion
|
||||||
var c = openTransf(g, prc.getModule, "", idgen)
|
var c = openTransf(g, prc.getModule, "", idgen)
|
||||||
result = liftLambdas(g, prc, getBody(g, prc), c.tooEarly, c.idgen)
|
result = liftLambdas(g, prc, getBody(g, prc), c.tooEarly, c.idgen, force)
|
||||||
result = processTransf(c, result, prc)
|
result = processTransf(c, result, prc)
|
||||||
liftDefer(c, result)
|
liftDefer(c, result)
|
||||||
result = liftLocalsIfRequested(prc, result, g.cache, g.config, c.idgen)
|
result = liftLocalsIfRequested(prc, result, g.cache, g.config, c.idgen)
|
||||||
|
|
|
||||||
|
|
@ -1271,7 +1271,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
let ast = a.sym.ast.shallowCopy
|
let ast = a.sym.ast.shallowCopy
|
||||||
for i in 0..<a.sym.ast.len:
|
for i in 0..<a.sym.ast.len:
|
||||||
ast[i] = a.sym.ast[i]
|
ast[i] = a.sym.ast[i]
|
||||||
ast[bodyPos] = transformBody(c.graph, c.idgen, a.sym, useCache)
|
ast[bodyPos] = transformBody(c.graph, c.idgen, a.sym, useCache, force=true)
|
||||||
ast.copyTree()
|
ast.copyTree()
|
||||||
of opcSymOwner:
|
of opcSymOwner:
|
||||||
decodeB(rkNode)
|
decodeB(rkNode)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue