mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
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???
notes
Prefer moving tests to a non-js directory so that they get tested across all backends automatically. Ideally, tests/js should be reserved to code that only makes sense in js.
Note also that tests for a js specific module (e.g.: std/jsbigints) belong to tests/stdlib, (e.g.: tests/stdlib/tjsbigints.nim)