Chevrotain / chevrotain

Parser Building Toolkit for JavaScript
https://chevrotain.io
Apache License 2.0
2.48k stars 204 forks source link

fix: suppress Firefox warning of unreachable code #1789

Closed medihack closed 2 years ago

medihack commented 2 years ago

I tested it with the benchmark_web/index_next.html in Firefox and it seems to work.

Fixes #1787

bd82 commented 2 years ago

Thanks @medihack

It seems that during webpacking the code gets transformed to:

    // Always true condition to suppress the Firefox warning of unreachable
    // code after a return statement.
    if (true)
        return toBecomeFast;

But as there is no performance regression, it is still a valid quick win. Long term we may want attempt to use a 3rd party library for this