first steps for cleaner static/const distinction
This commit is contained in:
parent
1d8ff40f56
commit
c25ffbf262
19 changed files with 193 additions and 66 deletions
|
|
@ -6,14 +6,14 @@ import macros
|
|||
|
||||
# Test compile-time state in same module
|
||||
|
||||
var gid = 3
|
||||
var gid {.compileTime.} = 3
|
||||
|
||||
macro genId(invokation: expr): expr =
|
||||
result = newIntLitNode(gid)
|
||||
inc gid
|
||||
|
||||
proc Id1(): int = return genId()
|
||||
proc Id2(): int = return genId()
|
||||
proc Id1(): int {.compileTime.} = return genId()
|
||||
proc Id2(): int {.compileTime.} = return genId()
|
||||
|
||||
echo Id1(), " ", Id2()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue