There are two pieces of code.
import macros
macro foo(): stmt =
result = quote do:
let foofoo = not true
echo treeRepr(result)
echo repr(result)
foo()
Outputs:
StmtList
LetSection
IdentDefs
Sym "foofoo"
Empty
Prefix
OpenSymChoice
Sym "not"
Sym "not"
Sym "not"
Sym "not"
Sym "not"
Sym "not"
Sym "true"
let foofoo = (system.not|system.not|system.not|system.not|system.not|system.not|...) true
And
import macros, tables
macro bar(): stmt =
result = quote do:
var a = initTable[int, int]();
let b = a.hasKey(1)
echo treeRepr(result)
echo repr(result)
bar()
Outputs:
StmtList
VarSection
IdentDefs
Sym "a"
Empty
Call
BracketExpr
Sym "initTable"
Sym "int"
Sym "int"
LetSection
IdentDefs
Sym "b"
Empty
Call
DotExpr
Sym "a"
OpenSymChoice
Sym "hasKey"
Sym "hasKey"
Sym "hasKey"
Sym "hasKey"
Sym "hasKey"
Sym "hasKey"
IntLit 1
var a = initTable[int, int]()
let b = a.(tables.hasKey|tables.hasKey|tables.hasKey|tables.hasKey|tables.hasKey|tables.hasKey|...)(
1)
Why are there so many not and hasKey, it should only one.
OK, I understand.
Thanks.