-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Issue#393 #1091
New issue
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
Issue#393 #1091
Conversation
var isBreakExists: boolean = false ; | ||
isBreakExists = forEach(node.statements, node => { | ||
if (node.kind === SyntaxKind.BreakStatement) { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it could be something like this
case SyntaxKind.... : return writer.write(....); and this shouldn't be fall through
First off, thanks for sending us a PR, we love contributions and interesting ideas for the compiler like this. On one hand, this is nice because it's explicit and gives nice output. On the other, if the user didn't ask for it, I feel like this might be more trouble than it's worth, especially since I believe we'd preserve comments like @sheetalkamat gave a simple example for which this is currently misleading. But what about something marginally more complex like switch (foo.kind) {
case SyntaxKind.BarToken:
if (foo.blah === "xyz") {
break;
}
else {
break;
}
case SyntaxKind.BazToken:
// ...
break;
} So even if you also handled switch (foo.kind) {
case 0 /* BarToken */:
if (foo.blah === "xyz") {
break;
}
else {
break;
}
/* falls through */
case 42 /* BazToken */:
// ...
break;
} And so the user would be annoyed to see that The answer might be to traverse the whole subtree with |
I thought the idea behind #393 was that the compiler code itself should have documented fall-throughs, not that we would auto-generate a comment indicating a fall-through. I don't see any value in the latter. |
#393 was a issue I created. What I intended was that the code should be documented that this was intended because if it wasn't intended it might cause weird side effects. So I did not intend automatic comment insertion. |
I am closing this PR , we can discuss this Issue on #393 . |
Adds /* falls through */ in case statement, if
break
missing.Tests not included ( working on )
#393
I am trying to build in `jake local' and 'jake tests' getting an error error TS6053: File 'Data.ts' not found. but 'jake LKG' seems to be working