From 541c2a3fecd7b1f3e6d9dc7e23a7583000cb68f1 Mon Sep 17 00:00:00 2001 From: cooldome Date: Thu, 28 Jun 2018 09:21:09 +0100 Subject: [PATCH] one more attempt --- compiler/ast.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index a52cf21445..6ad8d78f56 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1692,12 +1692,14 @@ proc isException*(t: PType): bool = # check if `y` is object type and it inherits from Exception assert(t != nil) + if t.kind notin {tyObject, tyGenericInst}: + return false + var base = t - while base != nil and base.kind in {tyRef, tyObject, tyGenericInst, tyAlias}: + while base != nil: if base.sym != nil and base.sym.magic == mException: return true - if base.len == 0: break - else: base = base.lastSon + base = base.lastSon return false proc isImportedException*(t: PType; conf: ConfigRef): bool =