diff --git a/compiler/dfa.nim b/compiler/dfa.nim index 0cefec2858..7db5f5f65a 100644 --- a/compiler/dfa.nim +++ b/compiler/dfa.nim @@ -541,8 +541,8 @@ template genNoReturn(c: var Con; n: PNode) = c.code.add Instr(n: n, kind: goto, dest: high(int) - c.code.len) proc genRaise(c: var Con; n: PNode) = - genJoins(c, n) gen(c, n[0]) + genJoins(c, n) if c.inTryStmt > 0: c.tryStmtFixups.add c.gotoI(n) else: @@ -553,11 +553,11 @@ proc genImplicitReturn(c: var Con) = gen(c, c.owner.ast[resultPos]) proc genReturn(c: var Con; n: PNode) = - genJoins(c, n) if n[0].kind != nkEmpty: gen(c, n[0]) else: genImplicitReturn(c) + genJoins(c, n) genNoReturn(c, n) const diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 680a383970..9e5207437c 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -314,7 +314,7 @@ proc genDiscriminantAsgn(c: var Con; n: PNode): PNode = # discriminator is ordinal value that doesn't need sink destroy # but fields within active case branch might need destruction - # tmp to support self assignments + # tmp to support self assignments let tmp = getTemp(c, n[1].typ, n.info) c.addTopVar(tmp) @@ -329,7 +329,7 @@ proc genDiscriminantAsgn(c: var Con; n: PNode): PNode = if hasDestructor(objType): if objType.attachedOps[attachedDestructor] != nil and sfOverriden in objType.attachedOps[attachedDestructor].flags: - localError(c.graph.config, n.info, errGenerated, """Assignment to discriminant for object's with user defined destructor is not supported, object must have default destructor. + localError(c.graph.config, n.info, errGenerated, """Assignment to discriminant for object's with user defined destructor is not supported, object must have default destructor. It is best to factor out piece of object that needs custom destructor into separate object or not use discriminator assignment""") result.add newTree(nkFastAsgn, le, tmp) return @@ -957,6 +957,10 @@ proc p(n: PNode; c: var Con; mode: ProcessMode): PNode = for i in 0..