summary refs log tree commit diff stats
path: root/tests/js
Commit message (Collapse)AuthorAgeFilesLines
* fix system for nimscript config files on js backend (#24135)metagn2024-09-192-0/+2
| | | | | | | | | | | fixes #21441 When compiling for JS, nimscript config files have both `defined(js)` and `defined(nimscript)` be true at the same time. This is required so that the nimscript config file knows the current compilation is for the JS backend. However the system module doesn't account for this in some cases, defining JS-specific code or not defining nimscript-specific code when compiling such nimscript files. To fix this, have the `nimscript` define take priority over the `js` one.
* fixes jsbigint64 regression; keeps convs to `Number` in danger mode (#23926)ringabout2024-08-111-0/+17
| | | fixes jsbigint64 regression
* Replacement PR for https://github.com/nim-lang/Nim/pull/23779 that (#23793)c-blake2024-07-071-1/+1
| | | | | | | makes new hash the default, with an opt-out (& js-no-big-int) define. Also update changelog (& fix one typo). Only really expect the chronos hash-order sensitive test to fail until they merge that PR and tag a new release.
* implement `legacy:jsNoLambdaLifting` for compatibility (#23727)ringabout2024-06-171-0/+1
|
* fixes #23522; fixes pre-existing wrong type for iter in `liftIterSym` (#23538)ringabout2024-04-261-0/+3
| | | fixes #23522
* fixes #4695; closure iterators support for JS backend (#23493)ringabout2024-04-181-4/+1
| | | | | | | | | | | | | | | | | | | | | | | fixes #4695 ref https://github.com/nim-lang/Nim/pull/15818 Since `nkState` is only for the main loop state labels and `nkGotoState` is used only for dispatching the `:state` (since https://github.com/nim-lang/Nim/pull/7770), it's feasible to rewrite the loop body into a single case-based dispatcher, which enables support for JS, VM backend. `nkState` Node is replaced by a label and Node pair and `nkGotoState` is only used for intermediary processing. Backends only need to implement `nkBreakState` and `closureIterSetupExc` to support closure iterators. pending https://github.com/nim-lang/Nim/pull/23484 <del> I also observed some performance boost for C backend in the release mode (not in the danger mode though, I suppose the old implementation is optimized into computed goto in the danger mode) </del> allPathsAsgnResult???
* [JS backend] improve `discard` statement; ridding of the awkward special ↵ringabout2024-04-131-1/+1
| | | | | | | | | | variable `_` (#23498) According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/Expression_statement, some expression statements need parentheses to make it unambiguous. `_` introduced in the https://github.com/nim-lang/Nim/pull/15789 is unnecessary. We can get rid of it by adding parentheses so that object literals are not ambiguous with block statements.
* fixes #4299 #12492 #10849; lambda lifting for JS backend (#23484)ringabout2024-04-113-7/+4
| | | | | | | | fixes #4299 fixes #12492 fixes #10849 It binds `function` with `env`: `function.bind(:env)` to ease codegen for now
* fixes JS tests (#23479)ringabout2024-04-051-1/+1
|
* Update tests/js/tos.nim, make isAbsolute tested on nodejs under Windows. ↵lit2024-03-091-6/+4
| | | | | | | | (#23377) Windows's nodejs `isAbsolute` issue has been resolved by [this PR](https://github.com/nim-lang/Nim/pull/23365). So we can improve the coverage for Windows.
* Don't recurse into inner functions during asyncjs transform (#23036)Jake Leahy2023-12-061-0/+5
| | | Closes #13341
* minor fixes for node20 (#22894)ringabout2023-10-311-1/+1
|
* make jsffi properly gensym (#22539)metagn2023-08-231-0/+6
| | | fixes #21208
* fix VM uint conversion size bug, stricter int gen on JS (#22150)metagn2023-06-251-0/+21
| | | | | | | | | | | * fix VM uint conversion bug, stricter int gen on JS fixes #19929 * fix float -> uint64 conversion too * no need to mask to source type * simpler diff with explanation, add test for described issue
* `strutils.split/rsplit` now return src on an empty sep (#22136)Zoom2023-06-211-6/+1
| | | | | | | | | | | | | | | This is a rebase of an earlier rejected PR. Following the discussion around it, this commit provides a valid output for and edge case of an empty separator for `split` and `rsplit` routines. The empty separator is interpreted as "split by no separators" and the initial string is returned. This is consistent with the behaviour of the `set[char]` version of `split`/`rsplit` routines and unifies them all. Compared to a commit merged earlier, this one has a benefit of not using assertions that will be removed in release builds and thus still not preventing possible infinite loops (which was the earlier behaviour for this edge case for separator of type `string`). Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #19863; move sha1, md5 to nimble packages for 2.0 (#21702)ringabout2023-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move sha1, md5 to nimble packages * boot the compiler * fixes tests * build the documentation * fixes docs * lol, I forgot koch.nim * add `nimHasChecksums` define * clone checksums but maybe copying is better * bump nimble hash * use ChecksumsStableCommit * fixes tests * deprecate them * fixes paths * fixes koch
* stdlib tests now check refc too (#21664)ringabout2023-04-211-1/+1
| | | | | | | | | | | * stdlib tests now check refc too * typo * fixes line numbers * disable cpp * do not touch
* int64/uint64 as bigint in JS (#21613)metagn2023-04-111-3/+8
| | | | | | | | | | | * int64/uint64 as bigint in JS * fix CI * convert to compile option * fix lie * smaller diff, changelog entry
* fixes #21439; Add tyOpenArray to genTypeInfo. (#21440)Constantine Molchanov2023-02-271-0/+14
| | | | | * fixes #21439; Add tyOpenArray to genTypeInfo. * Add test.
* Specify that address is taken when converter takes a var parameter (#21391)Jake Leahy2023-02-211-0/+15
| | | | | | | * Add test case * closes #21247 Add the sfAddrTaken flag to var parameters in converters This allows the JS backend to properly pass the parameter as a fat pointer
* `std/asyncjs` allow transforming proc types (#21356)Jake Leahy2023-02-141-0/+5
| | | | | * Add test case * Implement JS async transform for nnkProcTy
* fixes #21209; exclude threads options for JS (#21233)ringabout2023-01-082-0/+7
|
* JS backend properly extends string with `setLen` (#21087)Jake Leahy2022-12-131-0/+11
| | | | | * Add test case * Extend string with '0' when setting length to be longer
* Refactor JS sourcemap generator (#21053)Jake Leahy2022-12-131-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Parse the new line format * Fix pattern Didn't have space after the path * Remove duplicate sources Sources would sometimes double up with a new line at the end * Remove unused variable * Refactor sourcemap.nim Removes the multiple translations needed, now goes from single high level type to the final SourceMap Adds documentation for procs * Line numbers line up properly now Files aren't linking correctly though * Files now link up correctly Lines are sometimes off but overall seems pretty good Just need to implement parser * Add column info to output Add sourceMappingURL to rope directly to prevent copy * Properly handle columns * Remove debug lines * Add testcase * Finish testcase * Use the outdir folder instead of the folder the test is in to find the sourcemap Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* build the documentation of official packages (#20986)ringabout2022-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remove db stuffs * remove punycode * remove * fixes script * add cloner * patches * disable * patch * fixes external packages * disable two packages * preview documentation build * try again * fixes URL * fixes a bug * simplify * fixes documentaion * fixes * Apply suggestions from code review
* deprecate `do:` meaning `do ():` + misc cleanup (#20927)metagn2022-12-062-2/+2
| | | | | | | | | | | | | | | | | * test disable do: block lambda lifting * fix last test [skip ci] * deprecate `do:` meaning `do ():` + misc cleanup closes https://github.com/nim-lang/RFCs/issues/486 * oops * fix * no idea what could be causing nimsuggest failure other than this * ensure ci works
* move `smtp` to nimble packages (#20953)ringabout2022-11-301-1/+1
| | | | | | | | | * move `smtp` to nimble packages * fixes * install smtp * yes
* fix #8821 JS codegen can produce extreme switch statements with case … ↵Bung2022-10-141-4/+1
| | | | | | | (#20548) * fix #8821 JS codegen can produce extreme switch statements with case a of range * remove totalRange
* fixes devel CI (#20512)ringabout2022-10-071-1/+1
|
* add default field support for object in ARC/ORC (#20480)ringabout2022-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fresh start * add cpp target * add result support * add nimPreviewRangeDefault * reduce * use orc * refactor common parts * add tuple support * add testcase for tuple * cleanup; fixes nimsuggest tests * there is something wrong with cpp * remove * add support for seqs * fixes style * addd initial distinct support * remove links * typo * fixes tuple defaults * add rangedefault * add cpp support * fixes one more bugs * add more hasDefaults * fixes ordinal types * add testcase for #16744 * add testcase for #3608 * fixes docgen * small fix * recursive * fixes * cleanup and remove tuple support * fixes nimsuggest * fixes generics procs * refactor * increases timeout * refactor hasDefault * zero default; disable i386 * add tuples back * fixes bugs * fixes tuple * add more tests * fix one more bug regarding tuples * more tests and cleanup * remove messy distinct types which must be initialized by original types * add tests * fixes zero default * fixes grammar * fixes tests * fixes tests * fixes tests * fixes comments * fixes and add testcase * undo default values for results Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
* move widestrs out of system (#20462)metagn2022-10-011-0/+5
| | | | | * move widestrs out of system * fix osproc
* fix #20233 Float ranges in case statement in JS crash compiler (#20349)Bung2022-09-141-0/+7
|
* [js] add testcase for array indexDefect and remove todo (#19838)flywind2022-06-101-0/+9
| | | | | | | | | * remove unused opcSubstr * [js] add testcase for array indexDefect * Revert "remove unused opcSubstr" This reverts commit cb461f2545234d62c1e0b83318f3e5495c97de52.
* undefine C symbols in JS backend [backport:1.6] (#19437)flywind2022-02-041-0/+6
| | | fix #19330; fix #19059
* Optimize lent in JS [backport:1.6] (#19393)hlaaftana2022-01-171-0/+33
| | | | | | | * Optimize lent in JS [backport:1.6] * addr on lent doesn't work anymore, don't use it * use unsafeAddr in test again for older versions
* deprecate unsafeAddr; extend addr (#19373)flywind2022-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99c507048a8396e636bf22d55fdd84d7d1c. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* Use openarray of bytes in md5 (#19307)hlaaftana2022-01-151-2/+1
| | | | | | | | | | * Use openarray of bytes in md5 * fix CI * cleanup * use noSideEffect for bootstrapping * fix CI again * actually fix CI by checking if it works * this is getting ridiculous * put old md5 version in compiler, remove vmop
* style usages part one (openarray => openArray) (#19321)flywind2022-01-043-5/+5
| | | | | * style usages (openArray) * revert doc changes
* Update JS and nimscript import tests (#19306)hlaaftana2022-01-011-19/+24
| | | | | * add new modules, except experimental ones * remove deprecated modules mersenne and sharedlist * better describe why some modules fail and some modules don't
* envPairs works in vm, nims (#18615)Timothee Cour2021-09-291-26/+2
| | | | | * envPairs works in vm, nims * fixup
* fix CI failure(upstream changes) (#18820)flywind2021-09-081-1/+1
| | | | | | | | | * fix upstream changes * Update tests/js/tunittest_error2.nim Co-authored-by: flywind <xzsflywind@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix #16993, #18054, #17835 runnableExamples now works with templates and ↵Timothee Cour2021-06-021-1/+1
| | | | nested templates (#18082)
* followup #16871 asyncjs.then: allow pipelining procs returning futures (#17189)Timothee Cour2021-03-043-0/+22
| | | | | | | | | | * followup #16871 asyncjs.then: allow pipelining procs returning futures * rename test files where they belong * fix tests * tests for then with `onReject` callback * rename test file containing fail to avoid messing with grep * address comments * cleanup * un-disable 1 test
* fix #17177 (#17243)flywind2021-03-031-0/+10
| | | | | | | | | * remove unnecessary when statement * remove outdated codes * fix #17177 * add testcase
* asyncjs: add `then`, `catch` for promise pipelining (#16871)Timothee Cour2021-02-242-18/+84
| | | | | | * asyncjs: add then * improve tests, changelog, API * fix cryptic windows error: The parameter is incorrect * address comments
* array literals uses typed arrays; fix a jsgen bug (#16850)flywind2021-02-153-15/+32
| | | | | | | * array litterals uses typed arrays * Update compiler/jsgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixed dot operator recursive loop & macro suggest (#16922)Saem Ghani2021-02-151-1/+17
| | | | | | | | | | | | | | | | | | * basic stability improvements; refs nimsuggest * fixed dot operator recursive loop & macro suggest * hacky fix for run away dot operator sem check Committing this mostly to make the issue more clear. Perhaps get better feedback. * semExprWithType seems like a better place to check * fixed error messages const case expressions * Clean-up test * stopped the dot operator madness No longer get infinite recursion when seming broken code with a dot operator macro like in jsffi. Co-authored-by: Araq <rumpf_a@web.de>
* fix #16978 unittest js foreign exception (#16998)Timothee Cour2021-02-131-0/+16
| | | | * fix #16978 unittest js foreign exception
* Make parseopt available on all backends (#17009)hlaaftana2021-02-131-1/+1
| | | | | | | | | * Make parseopt available on all backends * fix spaces * fix getopt and update prelude * no crazy unnecessary version checks, use doAssert
* [backport:1.4] JS cstring null fixes (#16979)hlaaftana2021-02-111-1/+9
| | | | | * [backport:1.4] JS cstring null fixes * fix JS move string * make it look cleaner