summary refs log tree commit diff stats
path: root/tests/misc/tstrdesc.nim
Commit message (Expand)AuthorAgeFilesLines
* Merge pull request #1075 from flaviut/inlinedocsAndreas Rumpf2014-04-091-0/+14
previous revision' href='/ahoang/Nim/blame/tests/misc/treservedcidentsasfields.nim?h=devel&id=dbfc5c5a44a3e04f7bb3334abf8bf4252e383262'>^
2bc016b17 ^
eb3c9e1d1 ^









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
26
27
28
29
30
31
32
33
34
35
36
37
38
39



























                                                          
                                                                              









                                                                                    
discard """
  targets: "c cpp"
"""

import macros

macro make_test_type(idents: varargs[untyped]): untyped =
  result = nnkStmtList.newTree()

  var ident_defs: seq[NimNode] = @[]
  for i in idents:
    ident_defs.add newIdentDefs(i, ident("int"))

  result.add newTree(nnkTypeSection,
    newTree(nnkTypeDef,
      ident("TestType"),
      newEmptyNode(),
      newTree(nnkObjectTy,
        newEmptyNode(),
        newEmptyNode(),
        newTree(nnkRecList,
          ident_defs
        )
      )
    )
  )

make_test_type(
  auto, bool, catch, char, class, compl, const_cast, default, delete, double,
  dynamic_cast, explicit, extern, false, float, friend, goto, int, long,
  mutable, namespace, new, operator, private, protected, public, register,
  reinterpret_cast, restrict, short, signed, sizeof, static_cast, struct, switch,
  this, throw, true, typedef, typeid, typeof, typename, union, packed, unsigned,
  virtual, void, volatile, wchar_t, alignas, alignof, constexpr, decltype, nullptr,
  noexcept, thread_local, static_assert, char16_t, char32_t
)

# Make sure the type makes it to codegen.
var test_instance: TestType