mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 01:44:37 +00:00
19 lines
292 B
Nim
19 lines
292 B
Nim
discard """
|
|
cmd: "nim c --expandMacro:foo $file"
|
|
nimout: '''Hint: expanded macro:
|
|
echo ["injected echo"]
|
|
var x = 4 [ExpandMacro]
|
|
'''
|
|
output: '''injected echo'''
|
|
"""
|
|
|
|
import macros
|
|
|
|
macro foo(x: untyped): untyped =
|
|
result = quote do:
|
|
echo "injected echo"
|
|
`x`
|
|
|
|
foo:
|
|
var x = 4
|