summary refs log tree commit diff stats
path: root/tests/ccgbugs/twrong_string_asgn.nim
Commit message (Expand)AuthorAgeFilesLines
* Resolve bugs with `deep recursion` of asyncdispatch.cheatfate2016-05-181-1/+1
* fixes a critical codegen bug triggered by .asyncAraq2015-09-101-0/+19
00 committer Araq <rumpf_a@web.de> 2014-03-23 17:48:10 +0100 fixes #404' href='/ahoang/Nim/commit/tests/vm/tcompiletimetable.nim?h=devel&id=5920edf6e4f44898210bb37a71324537dca9569a'>5920edf6e ^
201a08e9a ^

5920edf6e ^



201a08e9a ^
5920edf6e ^



26fb6cb07 ^
201a08e9a ^
5920edf6e ^


d15788d00 ^

5920edf6e ^

26fb6cb07 ^
5920edf6e ^




d15788d00 ^

201a08e9a ^
d15788d00 ^
26fb6cb07 ^
d15788d00 ^





26fb6cb07 ^
d15788d00 ^






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
40
41
42
43
44
45
46
47
48
49
           
              

   

          



          
                              



                                                
                    
                   


          

   

 
                            




                    

          
                                     
 
                                               





                                            
                       






                                  
discard """
  nimout: '''2
3
4:2
Got Hi
Got Hey'''
"""

# bug #404

import macros, tables, strtabs

var ZOOT{.compileTime.} = initTable[int, int](2)
var iii {.compiletime.} = 1

macro zoo: untyped =
  ZOOT[iii] = iii*2
  inc iii
  echo iii

zoo
zoo


macro tupleUnpack: untyped =
  var (y,z) = (4, 2)
  echo y, ":", z

tupleUnpack

# bug #903

var x {.compileTime.}: StringTableRef

macro addStuff(stuff, body: untyped): untyped =
  result = newNimNode(nnkStmtList)

  if x.isNil:
    x = newStringTable(modeStyleInsensitive)
  x[$stuff] = ""

macro dump(): untyped =
  result = newNimNode(nnkStmtList)
  for y in x.keys: echo "Got ", y

addStuff("Hey"): echo "Hey"
addStuff("Hi"): echo "Hi"
dump()