mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 23:41:29 +00:00
genTryCpp to catch by Nim type, ready for first review (#7196)
* Rewrite genTryCpp * correction * Implement polymorphic raise in cpp * revert backticks in emit * Cleanp a comment * revert test changes * better handling of <new> header
This commit is contained in:
@@ -274,13 +274,6 @@ __clang__
|
||||
# endif
|
||||
# define NIM_BOOL bool
|
||||
# define NIM_NIL 0
|
||||
struct NimException
|
||||
{
|
||||
NimException(struct Exception* exp, const char* msg): exp(exp), msg(msg) {}
|
||||
|
||||
struct Exception* exp;
|
||||
const char* msg;
|
||||
};
|
||||
#else
|
||||
# ifdef bool
|
||||
# define NIM_BOOL bool
|
||||
|
||||
@@ -320,7 +320,7 @@ proc raiseExceptionAux(e: ref Exception) =
|
||||
quitOrDebug()
|
||||
else:
|
||||
pushCurrentException(e)
|
||||
{.emit: "throw NimException(`e`, `e`->name);".}
|
||||
{.emit: "`e`->raise();".}
|
||||
else:
|
||||
if excHandler != nil:
|
||||
if not excHandler.hasRaiseAction or excHandler.raiseAction(e):
|
||||
|
||||
Reference in New Issue
Block a user