next steps to hygienic templates
This commit is contained in:
parent
5e15dec175
commit
da190876de
17 changed files with 97 additions and 76 deletions
|
|
@ -2290,6 +2290,9 @@ template doAssert*(cond: bool, msg = "") =
|
|||
if not cond:
|
||||
raiseAssert(astToStr(cond) & ' ' & msg)
|
||||
|
||||
when not defined(nimhygiene):
|
||||
{.pragma: inject.}
|
||||
|
||||
template onFailedAssert*(msg: expr, code: stmt): stmt =
|
||||
## Sets an assertion failure handler that will intercept any assert statements
|
||||
## following `onFailedAssert` in the current lexical scope.
|
||||
|
|
@ -2310,7 +2313,7 @@ template onFailedAssert*(msg: expr, code: stmt): stmt =
|
|||
## assert(...)
|
||||
##
|
||||
template raiseAssert(msgIMPL: string): stmt =
|
||||
let `msg` = msgIMPL
|
||||
let msg {.inject.} = msgIMPL
|
||||
code
|
||||
|
||||
proc shallow*[T](s: var seq[T]) {.noSideEffect, inline.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue