Fixed ret by var in js

This commit is contained in:
Yuriy Glukhov 2015-10-15 15:00:30 +03:00
commit 2166b7bc46
8 changed files with 78 additions and 22 deletions

30
tests/varres/tvarres0.nim Normal file
View file

@ -0,0 +1,30 @@
discard """
output: '''123
1234
123
1234
12345
'''
"""
# Test simple type
var a = 123
proc getA(): var int = a
echo getA()
getA() = 1234
echo getA()
# Test object type
type Foo = object
a: int
var f: Foo
f.a = 123
proc getF(): var Foo = f
echo getF().a
getF().a = 1234
echo getF().a
getF() = Foo(a: 12345)
echo getF().a

View file

@ -8,10 +8,6 @@ proc divmod(a, b: int): tuple[di, mo: int] =
return (a div b, a mod b)
var (x, y) = divmod(15, 6)
stdout.write(x)
stdout.write(" ")
stdout.write(y)
echo x, " ", y
#OUT 2 3