diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-10-12 17:42:15 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-10-12 17:42:15 +0200 |
commit | a2e4ab2e4e3570cd313e8d5422b276625f87e0d7 (patch) | |
tree | ceb4d096b6774bfe7fc5982c64d4eaaa10d56e44 /compiler/semstmts.nim | |
parent | d6c401acfbb738d0e91df18cc89c40dc1b28525c (diff) | |
download | Nim-a2e4ab2e4e3570cd313e8d5422b276625f87e0d7.tar.gz |
simple programs now work with the new destroyer pass
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index ccf332d3a..c8eda9d94 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -100,15 +100,16 @@ proc semProc(c: PContext, n: PNode): PNode include semdestruct proc semDestructorCheck(c: PContext, n: PNode, flags: TExprFlags) {.inline.} = - if efAllowDestructor notin flags and - n.kind in nkCallKinds+{nkObjConstr,nkBracket}: - if instantiateDestructor(c, n.typ) != nil: - localError(n.info, warnDestructor) - # This still breaks too many things: - when false: - if efDetermineType notin flags and n.typ.kind == tyTypeDesc and - c.p.owner.kind notin {skTemplate, skMacro}: - localError(n.info, errGenerated, "value expected, but got a type") + when not newDestructors: + if efAllowDestructor notin flags and + n.kind in nkCallKinds+{nkObjConstr,nkBracket}: + if instantiateDestructor(c, n.typ) != nil: + localError(n.info, warnDestructor) + # This still breaks too many things: + when false: + if efDetermineType notin flags and n.typ.kind == tyTypeDesc and + c.p.owner.kind notin {skTemplate, skMacro}: + localError(n.info, errGenerated, "value expected, but got a type") proc semExprBranch(c: PContext, n: PNode): PNode = result = semExpr(c, n) @@ -116,7 +117,7 @@ proc semExprBranch(c: PContext, n: PNode): PNode = # XXX tyGenericInst here? semProcvarCheck(c, result) if result.typ.kind == tyVar: result = newDeref(result) - when not newDestructors: semDestructorCheck(c, result, {}) + semDestructorCheck(c, result, {}) proc semExprBranchScope(c: PContext, n: PNode): PNode = openScope(c) |