Commit Graph

154 Commits

Author SHA1 Message Date
hlaaftana
c55506006f [backport:1.4] JS cstring null fixes (#16979)
* [backport:1.4] JS cstring null fixes
* fix JS move string
* make it look cleaner

(cherry picked from commit 81533a0014)
2021-02-17 18:36:05 +01:00
Timothee Cour
c346c0b91b [backport 1.0] add backend support for js bigint (#16606)
* add backend support for js bigint

* cleanup

* add tests

* add -d:nimHasJsBigIntBackend

* cleanup

* more tests

(cherry picked from commit 025ca660f7)
2021-02-01 15:18:27 +01:00
Timothee Cour
95efe6d3ca strengthen taddr.nim: add test case for #14578; reference other issues; test cpp (#15960)
(cherry picked from commit 1a47fc2291)
2020-11-16 07:25:40 +01:00
flywind
23b0b10886 fix #14157 (#15877)
* fix #14157

* Update compiler/jsgen.nim

* add changelog

* Update compiler/jsgen.nim

* Update tests/js/tmodify_cstring.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit 1f9bf43100)
2020-11-16 06:56:43 +01:00
flywind
bf446e8cec follow #15818 and close #7109 (#15823)
* follow #15818 and close #7109

* Update compiler/jsgen.nim

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>

Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
(cherry picked from commit fde17b159f)
2020-11-05 09:17:42 +01:00
flywind
45e87ade15 fix #8821 (#15809)
(cherry picked from commit 544cb107c7)
2020-11-05 09:16:00 +01:00
flywind
f235eb48a0 fix #15651 (#15800)
* fix

* minor

(cherry picked from commit 80b0748d75)
2020-11-05 09:12:17 +01:00
flywind
f6f1594cef [closes #11625 and closes #2488]add global and threadvar(with --threads:off mode ) pragmas supports for JS backend (#15772)
* add global pragma support for js backend

* globalThis

* add support for threadvar

* more tests

* Update compiler/jsgen.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit 2cfe5e0745)
2020-11-05 09:11:02 +01:00
flywind
a480cbddcc closes #7658 (#15784)
* fix #7658

* more

(cherry picked from commit 17f08b2939)
2020-11-05 09:08:49 +01:00
flywind
d426f75593 fix #15638 (#15789)
(cherry picked from commit f79ded3cb6)
2020-11-05 09:08:14 +01:00
flywind
051c201068 add testcase for #7127 (#15780)
(cherry picked from commit d8fb2379c9)
2020-11-05 09:08:01 +01:00
Bung
7cee63bba3 avoid #8231, bitwise move to mul,div (#15070)
* avoid #8231, bitwise move to mul,div

* add test for #8231

* fix bitwise move when div result is float

* bitwise move depends on typ.size
2020-08-25 09:58:32 +02:00
Bung
cac09a43ae 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>
2020-07-27 21:13:49 +02:00
Timothee Cour
e07d661d16 fix #14475; unittest.require now works with nim c; require and check now works with -d:nodejs (#14676)
* fix #14475; make unittest work with -d:nodejs

* fixup

* fixup

* disable inim, delaunay which failed after unittest.require got fixed

* re-enable tests that have been fixed
2020-07-14 13:14:32 +02:00
Timothee Cour
61f2f1f5c5 fix #14576 addr of param (including for lent) now works with nim js (#14577)
* fix #14576 addr(param) now works in nim js

* workaround https://github.com/nim-lang/Nim/issues/14578
2020-06-06 20:15:24 +02:00
Danil Yarantsev
b19ad22b90 Fix #14570 (#14571)
* Fix #14570
2020-06-06 09:31:19 +02:00
hlaaftana
80c360fceb fix #14350, cstrings in JS init as null (#14355)
* fix #14350, cstrings in JS init as null
2020-05-15 10:07:30 +02:00
Timothee Cour
c28a057a6b fix js stacktraces, unify all file,line,col formatting into a single function (#14230)
* fix https://github.com/timotheecour/Nim/issues/135 ; unify all file,line,col formatting into a single function
2020-05-05 14:56:15 +02:00
hlaaftana
0aefebb728 JS unittest stacktrace fix, cleanup js repr and inclrtl includes (#14168) 2020-04-30 17:04:53 +01:00
hlaaftana
707367e1ca many bugfixes for js (#14158)
* many bugfixes for js

fixes #12672, fixes #14153, closes #14123, closes #11331, fixes #11783, fixes #13966, fixes #14087, fixes #14117, closes #12256.

mostly fixes the fact that it was allowed to assign to newly created temp variables. additionally attempts to get rid of null initialized seqs/strings (though they might pop up here and there); this simplifies a lot of things and makes code size smaller. even if null seqs/strings pop up here and there it's still better than all those bugs existing.

* formatting fixes

* CI fixes

* more CI fixes
2020-04-29 20:55:09 +02:00
hlaaftana
800ce5b950 Fix negative indexed arrays for JS, refs #13966 (#14152)
* Fix negative arrays for JS, refs #13966

* small extra fix: no need to .slice() cstring in JS
2020-04-29 08:59:08 +02:00
Jacek Sieka
7d6cbf290a Error -> Defect for defects (#13908)
* Error -> Defect for defects

The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.

With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00
hlaaftana
cd9af6b804 StringStream & more stdlib modules support for JS/NimScript (#14095)
* StringStream & more stdlib modules support for JS/NimScript

* change back pegs test in line with #14134
2020-04-28 19:44:52 +02:00
Timothee Cour
bb982c644b $(a: float) now works consistently in nim js, avoiding printing floats as ints (#14134)
* fix https://github.com/timotheecour/Nim/issues/133; $(a: float) works in nim js like in other backends

* fix tests

* fix test for windows that prints 1.1e17 differently than other OS
2020-04-27 17:33:03 +02:00
hlaaftana
76ffa4fa25 fixes #14112, tests for #12892, #12671, #11697 (#14125) 2020-04-26 10:12:16 +02:00
Euan
0b4a475f2e Ref #14075 - enable two tests which seem to now be passing locally on FreeBSD. (#14076) 2020-04-22 23:35:22 +01:00
Timothee Cour
7ce0358351 fix #13222: make relativePath more robust and flexible (#13451)
* * relativePath(foo) now works
* relativePath(rel, abs) and relativePath(abs, rel) now work (fixes #13222)
* relativePath, absolutePath, getCurrentDir now available in more targets (eg: vm, nodejs etc)
* fix bug: isAbsolutePath now works with -d:js; add tests
* workaround https://github.com/nim-lang/Nim/issues/13469
* remove `relativePath(path)` overload for now
* add back changelog after rebase
2020-04-21 23:53:55 +02:00
Timothee Cour
a43583f9c8 relativePath("foo", "foo") is now ".", not "" (#13452) 2020-02-22 09:07:53 +01:00
Miran
352232e62d style fix: change 'JS' to 'js' to make it consistent (#13168) 2020-01-16 14:14:03 +01:00
Andreas Rumpf
675ca997fb fixes #9674 [backport] (#13143) 2020-01-14 16:20:48 +01:00
Andreas Rumpf
d56848878c fixes #13119 (#13128)
* fixes #13119
* fixes a regression
2020-01-14 09:56:08 +01:00
Miran
1551fff853 clean up deprecated stuff and unused imports in tests (#13059) 2020-01-07 09:49:08 +01:00
Euan
c5c6bae2a4 #12103 - CI for FreeBSD (#12179)
* Ref #12103 - adds FreeBSD CI
* Fix getApplFreebsd - length of the string includes the null terminator byte, so minus 1 for result length
* Show last commit in setup task.
* Remove .git from repository URL
* Don't include noisy details showing last commit.
* Add FreeBSD build status badge
* Fix #12182 - disable tconsole on FreeBSD
* Disable tgetaddrinfo on FreebSD as getaddrinfo doesn't support the ICMP protocol.
* Install boehm-gc-threaded
* Use libgc-threaded.so on FreeBSD rather than libgc.so.
* Simplify build failure handling. Update alt text for CI badge.
* Disable test on FreeBSD
* Simplify build config

- use GNU make to build csources
- set PATH variable using the environment key
- remove modification of config to set CC as this is already set

* Install git which seems to be missing from current freebsd images
* Revert change to how path is set
* Add a comment explaining why the length is truncated
* Fix tconsole.
2019-11-29 21:00:54 +01:00
Arne Döring
04614a30bd fix in tests/js/tconsole (#12709) 2019-11-25 10:30:22 +01:00
Oscar Nihlgård
4ac100c912 Fix jsgen bug with uninitialized seq (#12500) [backport] 2019-10-24 11:17:01 +02:00
hlaaftana
ba43156363 Sets need copying in JS (#11392)
* Sets need copying in JS
* Fixes #11353
* Add test for #11353
2019-10-02 21:01:59 +02:00
Arne Döring
38ab51c445 importjs symbol (#12218)
* importjs symbol
* importjs warning message, minor warning fixes
2019-09-20 20:26:30 +02:00
narimiran
3ccda773d6 close #11166 by adding a test 2019-07-25 10:05:02 +02:00
Araq
eaf4b42ff9 JS codegen: supports toOpenArray [bugfix] 2019-07-12 10:11:59 +02:00
Andreas Rumpf
1c64934f46 implement system.default for the JS target 2019-03-05 19:58:54 +01:00
Araq
257965e105 fixes 10697 [backport] 2019-02-19 11:56:14 +01:00
Araq
b081eb4d6d fixes #10651 2019-02-14 15:55:38 +01:00
rec
f5cc2e2de5 Fixes 10202 (#10283)
* Add a test case for #10202
* Fix asgn for object tyVars; fixes #10202
* Check the variant kind before accessing the sym field
2019-01-12 19:49:31 +01:00
rec
ba7d33b4e4 Guard against null exception (#10162) 2019-01-04 15:05:03 +01:00
Alexander Ivanov
aadbdd6b06 Support undefined in isNil (#9960) 2018-12-30 02:48:37 +01:00
Yuriy Glukhov
39a8ab469a Fixed insert for nil seq in js (#10068) 2018-12-21 22:45:20 +01:00
rec
ca18dc2505 Make copies for params which are captured in closures. Fixes #7048 (#10050)
* Copy params which are captured in closures. Fixes #7048
* Forgot to emit a newline; minor adjustments to the test
2018-12-20 08:24:57 +01:00
recloser
19f5835d5c Fixes #10005 2018-12-15 22:57:18 +01:00
Arne Döring
a5ecbf823f lots of small changes 2018-12-11 21:23:22 +01:00
Arne Döring
465e742182 fix js category 2018-12-11 21:23:19 +01:00