diff options
author | Araq <rumpf_a@web.de> | 2019-04-09 21:25:23 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-04-09 21:25:36 +0200 |
commit | 72408842d9ca79e9b64691bb8fa906a3e1014a43 (patch) | |
tree | e94e39b5ecb66f9c26fec3634a46f84e22b34808 | |
parent | a4883b84260eb050b9e7756d48a22f7b6ead08f5 (diff) | |
download | Nim-72408842d9ca79e9b64691bb8fa906a3e1014a43.tar.gz |
koch.nim compiles with --newruntime
-rw-r--r-- | compiler/injectdestructors.nim | 10 | ||||
-rw-r--r-- | compiler/sempass2.nim | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 5f39a97b8..71ba61fb6 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -438,10 +438,10 @@ proc passCopyToSink(n: PNode; c: var Con): PNode = result.add tmp proc pArg(arg: PNode; c: var Con; isSink: bool): PNode = - template pArgIfTyped(arg_part: PNode): PNode = + template pArgIfTyped(argPart: PNode): PNode = # typ is nil if we are in if/case expr branch with noreturn - if arg_part.typ == nil: p(arg_part, c) - else: pArg(arg_part, c, isSink) + if argPart.typ == nil: p(argPart, c) + else: pArg(argPart, c, isSink) if isSink: if arg.kind in nkCallKinds: @@ -728,6 +728,10 @@ proc p(n: PNode; c: var Con): PNode = result.add n[0] # Analyse the inner expression result.add p(n[1], c) + of nkWhen: + # This should be a "when nimvm" node. + result = copyTree(n) + result[1][0] = p(result[1][0], c) of nkRaiseStmt: if optNimV2 in c.graph.config.globalOptions: # this is a bit hacky but we simply do not destroy exceptions that have diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 03fd34c86..67de3217a 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -707,9 +707,9 @@ proc track(tracked: PEffects, n: PNode) = let op = a.typ if getConstExpr(tracked.ownerModule, n, tracked.graph) != nil: return - if op != nil: + if n.typ != nil: if tracked.owner.kind != skMacro: - createTypeBoundOps(tracked.c, op, n.info) + createTypeBoundOps(tracked.c, n.typ, n.info) if a.kind == nkCast and a[1].typ.kind == tyProc: a = a[1] # XXX: in rare situations, templates and macros will reach here after |