blob: 299c52baa4941345f1d5277cf06774da324af929 (
plain) (
blame)
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
50
51
|
echo " 1: print me once!"
import hotcodereloading
let g_1* = 8 # devilish!
proc f_1*(): int =
var a {.global.} = 1
a.inc
return a
# all these constructs should compile
let some_glob_1 = 1
echo " 1: ", some_glob_1
if true:
let some_glob_2 = 2
echo " 1: ", some_glob_2
if true:
let some_glob_3 = 3
echo " 1: ", some_glob_3
block:
let some_glob_4 = 4
proc inBlock(num: int) =
echo " 1: ", num
inBlock(some_glob_4)
var counter = 3
while counter > 0:
let some_glob_5 = 5
echo " 1: ", some_glob_5
counter.dec
type
Type1 = object
a: int
b: int
var t = Type1(a: 42, b: 11)
echo " 1: Type1.a:", t.a
type
obj = ref object
dat: int
str: string
proc foo(): (int, obj) = (1, obj(dat: 3, str: "bar"))
let (aa, bb) = foo()
afterCodeReload:
echo aa
echo bb.str
|