summary refs log blame commit diff stats
path: root/tests/ic/mcompiletime_counter.nim
blob: 6fc7b3f2a8058d93c4c6234be742dae13b5d98b9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                          
import std/macros
import std/macrocache

const myCounter = CacheCounter"myCounter"

proc getUniqueId*(): int {.compileTime.} =
  inc myCounter
  result = myCounter.value

static:
  myCounter.inc(3)
  assert myCounter.value == 3