Use const rather than var when target es6#6597
Merged
DanielRosenwasser merged 6 commits intomicrosoft:masterfrom Jan 25, 2016
plantain-00:use_const_rather_than_var_when_target_es6
Merged
Use const rather than var when target es6#6597DanielRosenwasser merged 6 commits intomicrosoft:masterfrom plantain-00:use_const_rather_than_var_when_target_es6
DanielRosenwasser merged 6 commits intomicrosoft:masterfrom
plantain-00:use_const_rather_than_var_when_target_es6
Conversation
fetch latest code
fetch latest code
…on and the target is es6
Contributor
There was a problem hiding this comment.
Can you wrap this in a helper method, since you repeat this pattern 3 times in this PR
Member
There was a problem hiding this comment.
The function name (emitVar) is misleading and we probably don't need the function at all.
I'd prefer to just have a local in this function const varOrConst = (languageVersion <= ScriptTarget.ES5) ? 'var ' : 'const ';) and write(varOrConst) at these call sites.
Member
|
👍 |
Contributor
|
👍 Thanks! |
DanielRosenwasser
added a commit
that referenced
this pull request
Jan 25, 2016
…hen_target_es6 Use const rather than var when target es6
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
#6092