diff options
author | Araq <rumpf_a@web.de> | 2017-12-29 20:01:49 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-12-29 20:01:49 +0100 |
commit | cf259fbd1c7e2642d00ed6decbceec353b53c84e (patch) | |
tree | 5ea389e9d43d9156155b904b4e412d1fb1f0a49f /compiler | |
parent | f3a895f04321853f32b571a1f314d72c73274ff6 (diff) | |
download | Nim-cf259fbd1c7e2642d00ed6decbceec353b53c84e.tar.gz |
fixes #6972
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/renderer.nim | 1 | ||||
-rw-r--r-- | compiler/sem.nim | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim index d4b401c02..6735cc1ce 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -719,6 +719,7 @@ proc gcase(g: var TSrcGen, n: PNode) = var c: TContext initContext(c) var length = sonsLen(n) + if length == 0: return var last = if n.sons[length-1].kind == nkElse: -2 else: -1 if longMode(g, n, 0, last): incl(c.flags, rfLongMode) putWithSpace(g, tkCase, "case") diff --git a/compiler/sem.nim b/compiler/sem.nim index ababbd303..d2831827a 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -74,7 +74,7 @@ proc fitNode(c: PContext, formal: PType, arg: PNode; info: TLineInfo): PNode = localError(arg.info, errExprXHasNoType, renderTree(arg, {renderNoComments})) # error correction: - result = copyNode(arg) + result = copyTree(arg) result.typ = formal else: result = indexTypesMatch(c, formal, arg.typ, arg) @@ -168,9 +168,9 @@ proc commonType*(x, y: PType): PType = proc endsInNoReturn(n: PNode): bool = # check if expr ends in raise exception or call of noreturn proc var it = n - while it.kind in {nkStmtList, nkStmtListExpr} and it.len > 0: + while it.kind in {nkStmtList, nkStmtListExpr} and it.len > 0: it = it.lastSon - result = it.kind == nkRaiseStmt or + result = it.kind == nkRaiseStmt or it.kind in nkCallKinds and it[0].kind == nkSym and sfNoReturn in it[0].sym.flags proc commonType*(x: PType, y: PNode): PType = |