fix a compiler crash related to the new strings in C++ mode

This commit is contained in:
Zahary Karadjov 2018-05-03 11:42:15 +03:00 • committed by Andreas Rumpf
commit 4ab1cfb0b0
2 changed files with 9 additions and 9 deletions

View file

@ -1684,7 +1684,7 @@ proc isException*(t: PType): bool =
var base = t var base = t
while base != nil: while base != nil:
if base.sym.magic == mException: if base.sym != nil and base.sym.magic == mException:
return true return true
base = base.lastSon base = base.lastSon
return false return false

View file

@ -69,22 +69,22 @@ proc debug*(n: PNode) {.deprecated.}
template mdbg*: bool {.dirty.} = template mdbg*: bool {.dirty.} =
when compiles(c.module): when compiles(c.module):
c.module.fileIdx == gProjectMainIdx c.module.fileIdx.int32 == gProjectMainIdx
elif compiles(c.c.module): elif compiles(c.c.module):
c.c.module.fileIdx == gProjectMainIdx c.c.module.fileIdx.int32 == gProjectMainIdx
elif compiles(m.c.module): elif compiles(m.c.module):
m.c.module.fileIdx == gProjectMainIdx m.c.module.fileIdx.int32 == gProjectMainIdx
elif compiles(cl.c.module): elif compiles(cl.c.module):
cl.c.module.fileIdx == gProjectMainIdx cl.c.module.fileIdx.int32 == gProjectMainIdx
elif compiles(p): elif compiles(p):
when compiles(p.lex): when compiles(p.lex):
p.lex.fileIdx == gProjectMainIdx p.lex.fileIdx.int32 == gProjectMainIdx
else: else:
p.module.module.fileIdx == gProjectMainIdx p.module.module.fileIdx.int32 == gProjectMainIdx
elif compiles(m.module.fileIdx): elif compiles(m.module.fileIdx):
m.module.fileIdx == gProjectMainIdx m.module.fileIdx.int32 == gProjectMainIdx
elif compiles(L.fileIdx): elif compiles(L.fileIdx):
L.fileIdx == gProjectMainIdx L.fileIdx.int32 == gProjectMainIdx
else: else:
error() error()