Stop block transpilation after encountering a return statement#161
Merged
Stop block transpilation after encountering a return statement#161
Conversation
lolleko
requested changes
Jul 28, 2018
|
|
||
| // Don't transpile any dead code after a return | ||
| if (ts.isReturnStatement(statement)) { | ||
| break; |
| `class def { public static abc() { return 3; const a = 5; } } return def.abc();`); | ||
|
|
||
| Expect(result).toBe(3); | ||
| } |
Member
There was a problem hiding this comment.
namespaces also use transpire block a test would be nice.
Member
Author
There was a problem hiding this comment.
You cannot return from a namespace since it is not a function body.
lolleko
reviewed
Jul 28, 2018
| `if (true) { return 3; const b = 8; }`); | ||
|
|
||
| Expect(result).toBe(3); | ||
| } |
Member
There was a problem hiding this comment.
switch also use transpileblock irrc, but I think this is less important than the namespace test and probably not needed.
Codecov Report
@@ Coverage Diff @@
## master #161 +/- ##
==========================================
+ Coverage 96.02% 96.51% +0.49%
==========================================
Files 9 9
Lines 1081 1349 +268
Branches 179 247 +68
==========================================
+ Hits 1038 1302 +264
- Misses 18 22 +4
Partials 25 25
Continue to review full report at Codecov.
|
lolleko
approved these changes
Jul 29, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #153