summary refs log tree commit diff stats
path: root/tests/macros/tquotedo.nim
blob: cd1f691161304213f8ede66b22cd7784d930ad29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
discard """
output: '''
123
Hallo Welt
Hallo Welt
'''
"""

import macros

macro mac(): untyped =
  quote do:
    proc test(): int =
      (proc(): int = result = 123)()

mac()
echo test()

macro foobar(arg: untyped): untyped =
  result = arg
  result.add quote do:
    `result`

foobar:
  echo "Hallo Welt"