fixes #5986 js backend failed to compile try ... except new syntax (#6116)

This commit is contained in:
andri lim 2017-07-17 13:07:47 +07:00 • committed by Andreas Rumpf
commit c245cfc1fd
2 changed files with 14 additions and 1 deletions

View file

@ -53,7 +53,7 @@ proc isNimException(): bool {.asmNoStackFrame.} =
else: else:
asm "return `lastJSError`.m_type;" asm "return `lastJSError`.m_type;"
proc getCurrentException*(): ref Exception = proc getCurrentException*(): ref Exception {.compilerRtl, benign.} =
if isNimException(): result = cast[ref Exception](lastJSError) if isNimException(): result = cast[ref Exception](lastJSError)
proc getCurrentExceptionMsg*(): string = proc getCurrentExceptionMsg*(): string =

View file

@ -0,0 +1,13 @@
discard """
output: '''hello'''
"""
type
MyException = ref Exception
#bug #5986
try:
raise MyException(msg: "hello")
except MyException as e:
echo e.msg