mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 14:23:45 +00:00
Was debugging with `--expandMacro` and noticed that private fields weren't exported. Passes extra flags to the renderer to make them be shown
25 lines
406 B
Nim
25 lines
406 B
Nim
discard """
|
|
cmd: "nim c --expandMacro:foo $file"
|
|
nimout: '''texpandmacro.nim(20, 1) Hint: expanded macro:
|
|
echo ["injected echo"]
|
|
var x = 4
|
|
type
|
|
Hello = object
|
|
private: string [ExpandMacro]
|
|
'''
|
|
output: '''injected echo'''
|
|
"""
|
|
|
|
import macros
|
|
|
|
macro foo(x: untyped): untyped =
|
|
result = quote do:
|
|
echo "injected echo"
|
|
`x`
|
|
|
|
foo:
|
|
var x = 4
|
|
type
|
|
Hello = object
|
|
private: string
|