summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorYuriy Glukhov <yuriy.glukhov@gmail.com>2016-09-20 17:00:16 +0300
committerYuriy Glukhov <yuriy.glukhov@gmail.com>2016-09-20 17:01:53 +0300
commit82b022ebc6621f573c516ea59e9db4426d87a64e (patch)
treeaa8cf9145240dbf5639e8359c4b35a42f6940f44 /tests
parent09651bec5e0988a5f712049fdc0f9b41e7e37e98 (diff)
downloadNim-82b022ebc6621f573c516ea59e9db4426d87a64e.tar.gz
JS: Fixed ICE on ptr assignment
Diffstat (limited to 'tests')
-rw-r--r--tests/js/taddr.nim7
-rw-r--r--tests/js/tbyvar.nim8
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/js/taddr.nim b/tests/js/taddr.nim
index 1fba30d55..d8ff4c11b 100644
--- a/tests/js/taddr.nim
+++ b/tests/js/taddr.nim
@@ -70,3 +70,10 @@ proc testPtr(p: pointer, a: int) =
 var i = 123
 testPtr(addr i, 5)
 doAssert(i == 124)
+
+var someGlobal = 5
+proc getSomeGlobalPtr(): ptr int = addr someGlobal
+let someGlobalPtr = getSomeGlobalPtr()
+doAssert(someGlobalPtr[] == 5)
+someGlobalPtr[] = 10
+doAssert(someGlobal == 10)
diff --git a/tests/js/tbyvar.nim b/tests/js/tbyvar.nim
index 9714cd56b..40aebd13b 100644
--- a/tests/js/tbyvar.nim
+++ b/tests/js/tbyvar.nim
@@ -41,3 +41,11 @@ proc bar(s: var seq[int], a: int) =
   foo(s)
 s.bar(5)
 doAssert(s == @[123, 1])
+
+import tables
+block: # Test get addr of byvar return value
+  var t = initTable[string, int]()
+  t["hi"] = 5
+  let a = addr t["hi"]
+  a[] = 10
+  doAssert(t["hi"] == 10)