Closed marccarigiet closed 8 months ago
Thanks - I've just put a fix in for this. JS Regex is nasty as it's not apparent to the poor lexer (without lookahead) exactly what makes a RegEx start and what makes a division.
Do you have any other examples of non-numerals beforehand that cause issues that work on other engines? I fixed true/false/undefined/null
I'd be particularly interested if there was everyday JS that had problems - I feel like dividing true
by something is probably not something that would happen in non-buggy code :)
Hi there,
The only other non-numerals that work on other engines and caused that issue were with this and uninitialized variables. Admittedly divisions involving theses are also not everyday JS 😅
Description Certain divisions of non-numeral operands get interpreted as an unfinished Regex and trigger a Syntax Error.
Test case Test code to reproduce the behaviour:
Backtrace
Expected behaviour I am not entirely sure what the expected behaviour should be. Going by other JavaScript Engines, NaN or Infinity would both be possible. But I definitely wouldn't have expected the present behavior.
Additional context This was found using comparative testing between multiple JavaScript engines. This could very much come down to a design choice. I just wanted to let you know in case it is not intentional