diff options
author | Bung <crc32@qq.com> | 2020-07-28 03:13:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 21:13:49 +0200 |
commit | cac09a43aea0e8bcc6a7f2634cfcd4274a260b49 (patch) | |
tree | 556c72495802756b0d98fbe7cefd0ae552cda475 /tests/js | |
parent | 191c388792c1b57c3855e9c3b9c83293be8a6207 (diff) | |
download | Nim-cac09a43aea0e8bcc6a7f2634cfcd4274a260b49.tar.gz |
fix #11354 jsgen not carefully handle genAddr with nkHiddenAddr,nkStm… (#15078)
* fix #11354 jsgen not carefully handle genAddr with nkHiddenAddr,nkStmtListExpr; genAsgn with lvalue tyVar and rvalue tyPtr * correct logic * add test for #11354 * handle nkHiddenAddr when n.len == 1 * Update compiler/jsgen.nim * Update compiler/jsgen.nim * Apply suggestions from code review Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'tests/js')
-rw-r--r-- | tests/js/t11354.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/js/t11354.nim b/tests/js/t11354.nim new file mode 100644 index 000000000..8dee90de0 --- /dev/null +++ b/tests/js/t11354.nim @@ -0,0 +1,20 @@ +discard """ + output: ''' +0 +@[@[0, 1]] +''' +""" + +type + TrackySeq[T] = object + s: seq[T] + pos: int + +proc foobar(ls: var TrackySeq[seq[int]], i: int): var seq[int] = + echo ls.pos # removing this, or making the return explicit works + ls.s[i] + +var foo: TrackySeq[seq[int]] +foo.s.add(@[0]) +foo.foobar(0).add(1) +echo foo.s \ No newline at end of file |