summary refs log tree commit diff stats
path: root/tests/js/testobjs.nim
Commit message (Expand)AuthorAgeFilesLines
* Fixes #10005recloser2018-12-151-0/+17
* make JS tests greenAndreas Rumpf2018-08-131-1/+1
* fixes #6035Araq2017-06-301-1/+19
* Enabled taddr and testobjs testsyglukhov2015-05-271-4/+8
* Fixing extraneous semicolon in jsgen outputjuxiliary2014-12-061-0/+34
ref='/ahoang/Nim/commit/tests/destructor/tsimpleclosure.nim?h=devel&id=678beb8ef982a3477018ff7c8669c4a9c6f77545'>678beb8ef ^
0adb1c622 ^










678beb8ef ^



0adb1c622 ^



678beb8ef ^


0adb1c622 ^
0db3c670a ^














0adb1c622 ^

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


                                     
  


     
                              










                            



                                



                


                                      
      














                                             

                                                                           
discard """
  cmd: '''nim c --newruntime $file'''
  output: '''a b
70
hello
hello
hello
2 2  alloc/dealloc pairs: 0'''
"""

import core / allocators
import system / ansi_c

proc main(): owned(proc()) =
  var a = "a"
  var b = "b"
  result = proc() =
    echo a, " ", b


proc foo(f: (iterator(): int)) =
  for i in f(): echo i

proc wrap =
  let p = main()
  p()

  let fIt = iterator(): int = yield 70
  foo fIt

wrap()

# bug #11533
proc say = echo "hello"

# Error: internal error: genAssignment: tyNil
var err0: proc() = say
err0()

var ok0: proc()
ok0 = say
ok0()

var ok1 = say
ok1()

let (a, d) = allocCounters()
discard cprintf("%ld %ld  alloc/dealloc pairs: %ld\n", a, d, system.allocs)