flatty icon indicating copy to clipboard operation
flatty copied to clipboard

Fixes to javascript emissions

Open olliNiinivaara opened this issue 1 year ago • 2 comments

  • Fixes syntax errors by adding a "let" declaration to j loop variables.

  • Suppresses "unreachable code after return" warnings by adding no-op "if (true)" conditions.

olliNiinivaara avatar Jan 20 '25 11:01 olliNiinivaara

Why is this needed? Why does unreachable code after return get triggered?

treeform avatar Jan 20 '25 23:01 treeform

The "let" syntax error fix is of course critical.

But the extra if(true):s are just a minor improvement, to keep the firefox debugger to not show any warnings: when the emitted code is inlined to other javascript code and the unconditional return gets inserted in the middle of other code, the rest of the code can never be reached, and this triggers a warning.

olliNiinivaara avatar Jan 21 '25 07:01 olliNiinivaara