Proper C scopes for if, try and case statements
even thought the setjmp implementation for try statement won't be used in C++, using properly scoped variables for them is beneficial, because we'll be able to establish a 1:1 relation between nimrod scopes and C scopes. Once we have that, we'll be able to keep the original names of local variables to greatly improve the debugging experience (i.e. watch expressions and hover tooltips will work).
This commit is contained in:
parent
d2b45dbe85
commit
caf7878009
3 changed files with 103 additions and 83 deletions
|
|
@ -1593,12 +1593,12 @@ proc echo*[Ty](x: openarray[Ty]) {.magic: "Echo", noSideEffect.}
|
|||
template newException*(exceptn: typeDesc, message: string): expr =
|
||||
## creates an exception object of type ``exceptn`` and sets its ``msg`` field
|
||||
## to `message`. Returns the new exception object.
|
||||
block: # open a new scope
|
||||
var
|
||||
e: ref exceptn
|
||||
new(e)
|
||||
e.msg = message
|
||||
e
|
||||
# block: # open a new scope
|
||||
var
|
||||
e: ref exceptn
|
||||
new(e)
|
||||
e.msg = message
|
||||
e
|
||||
|
||||
when not defined(EcmaScript) and not defined(NimrodVM):
|
||||
{.push stack_trace: off.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue