mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
* pragma for sfCallsite instead of name check at every template definition Not documented because it seems to be for internal use? Should also make it possible to make comparisons and setops imports, but this doesn't have to be done. I can reuse a name like `cursor` for the pragma as well, added a new name just to be safe. * make sfCallsite recursive, add tests
21 lines
488 B
Nim
21 lines
488 B
Nim
discard """
|
|
nimout: '''
|
|
tcallsitelineinfo2.nim(18, 1) Warning: abc [User]
|
|
tcallsitelineinfo2.nim(19, 12) Warning: def [User]
|
|
'''
|
|
exitcode: 1
|
|
outputsub: '''
|
|
tcallsitelineinfo2.nim(20) tcallsitelineinfo2
|
|
Error: unhandled exception: ghi [ValueError]
|
|
'''
|
|
"""
|
|
|
|
template foo(a: untyped): untyped {.callsite.} =
|
|
{.warning: "abc".}
|
|
a
|
|
echo "hello"
|
|
|
|
foo: # with `{.line.}:`, the following do not keep their line information:
|
|
{.warning: "def".}
|
|
raise newException(ValueError, "ghi")
|