We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello there, seems like async switch cases with curly brackets report false-positives fall-throughs at nodent@3.2.13.
nodent@3.2.13
// index.js // ❌ (async () => { switch (true) { case true: { await Promise.resolve(); break; } } })();
$ ./nodent.js index.js --out /* /somewhere/index.js: 'use nodent*' directive missing/ignored, assumed 'use nodent;' */ Nodent: /somewhere/index.js(3:4) switch-case fall-through not supported - added break. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification (() => (function ($return, $error) { switch (true) { case true: return Promise.resolve().then((function ($await_2) { break; // 👈 Illegal break statement }).$asyncbind(this, $error), $error); } return $return(); }).$asyncbind(this, true))();
My guess is that nodent-transform wrongly reads the consequent end type as a BlockStatement.
nodent-transform
BlockStatement
Removing the curly brackets from the case in index.js transforms the file correctly. This works:
index.js
// index.js // ✅ (async () => { switch (true) { case true: await Promise.resolve(); break; } })();
$ ./nodent.js index.js --out /* /somewhere/index.js: 'use nodent*' directive missing/ignored, assumed 'use nodent;' */ (() => (function ($return, $error) { function $Switch_1() { return $return(); } switch (true) { case true: return Promise.resolve().then((function ($await_2) { return $Switch_1.call(this); }).$asyncbind(this, $error), $error); } return $Switch_1.call(this); }).$asyncbind(this, true))();
The text was updated successfully, but these errors were encountered:
fix(server): return instead of break at switch case ends
return
break
e9447e4
Closes: #140 Caused by: MatAtBread/nodent#116
No branches or pull requests
Hello there, seems like async switch cases with curly brackets report false-positives fall-throughs at
nodent@3.2.13
.My guess is that
nodent-transform
wrongly reads the consequent end type as aBlockStatement
.Removing the curly brackets from the case in
index.js
transforms the file correctly. This works:The text was updated successfully, but these errors were encountered: