-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[WIP] Promises to Async Await Code Fix #24939
Closed
elizabethdinella
wants to merge
208
commits into
microsoft:master
from
elizabethdinella:promisesToAsyncAwaitCodeFix
Closed
Changes from 194 commits
Commits
Show all changes
208 commits
Select commit
Hold shift + click to select a range
f3971df
updated build files
elizabethdinella 6f803f6
Initial commit of changing all functions that return a promise to async
elizabethdinella b8d8183
adding await to .then() works
elizabethdinella 69795c8
Try block is added
elizabethdinella 6c0a712
major refactor - still buggy
elizabethdinella 546ee1b
Fixed to allow for non inlined functions in a then()
elizabethdinella 8019335
Got catch blocks and onRej functions working
elizabethdinella 6e31ff9
Fixed try/catch formatting
elizabethdinella 469da81
Initial commit of recursive function to create cascading catch blocks
elizabethdinella 8c8ebe9
Fixed catch param names
elizabethdinella 635cc04
First commit of nested trys and cascading catches
elizabethdinella 5099bd1
Fixed the outermost catch to take the correct variable
elizabethdinella b8353dc
Refactored to use objects instead of tuple arrays
elizabethdinella 25efbed
Initial commit of recursive refactoring
elizabethdinella 0b760bf
Got inlined arrow functions working with recursive method
elizabethdinella d3a92d9
Fixed if not rej function
elizabethdinella 460c6dd
Added a couple tests
elizabethdinella 73ed97e
Added a series of test cases
elizabethdinella effb559
Fixed copy paste mistakes in tests
elizabethdinella 3b1aff1
Fixed linting errors
elizabethdinella 71b422d
Fixed suggestion diagnostics to only suggest when funciton is returni…
elizabethdinella 9b2aa30
Refactored to avoid using getChildren()
elizabethdinella 2384440
Created isPromiseLike function in the checker to replace my isPromise…
elizabethdinella b806922
Fixed formatting and spacing on tests and added es6 target
elizabethdinella 602a8a9
Fixed spacing on tests and added a couple more tests
elizabethdinella c1e5de6
More variable name fixes
elizabethdinella bece3e1
Fixed more variable name issues
elizabethdinella 4820eff
Added awaits to all callbacks that are function references (not defin…
elizabethdinella 84521cb
adding tests for multiple thens
elizabethdinella f9e3840
adding tests for multiple thens
elizabethdinella 8a80eef
Fixed merge conflicts
elizabethdinella dd69f0d
cherry pick
elizabethdinella 6e4810d
More cherry pick
elizabethdinella 024ad02
cherry pick
elizabethdinella 015f972
Initial commit of multiple thens
elizabethdinella 41e007e
Fixed error in fourslash case
elizabethdinella 5b958c5
Fixed merge conflicts
elizabethdinella 68e0195
oops
elizabethdinella 4f972ff
fixed more merge conflicts
elizabethdinella bc9d554
Refactored to use let declarations
elizabethdinella 25ea1b1
merge conflicts
elizabethdinella 515b5ff
initial commit of var -> let refactor
elizabethdinella 8104e36
Only create a let declaration when there is a rej or catch
elizabethdinella 4075943
Fixed rej after code to have labels to correct semantics. Also added …
elizabethdinella 92ecaf1
Fixed tests to not return awaits (redundant as async functions do thi…
elizabethdinella e29e0e8
merged tests
elizabethdinella 28dca79
Removed await keyword from returns
elizabethdinella 4ac1742
fixed minor typos
elizabethdinella cfc3418
merged tests
elizabethdinella 0b75df3
fixed more minors issues
elizabethdinella 4483758
Merge branch 'promisesToAsyncAwaitTest' of https://github.com/elizabe…
elizabethdinella f992010
Can't return statements in a block
elizabethdinella 2b56131
Merge branch 'promisesToAsyncAwaitTest' of https://github.com/elizabe…
elizabethdinella f113a41
fixed let declarations to be inside try blocks
elizabethdinella b1ff6d1
Merge branch 'promisesToAsyncAwaitTest' of https://github.com/elizabe…
elizabethdinella abeace9
fixed spacing
elizabethdinella caf2431
Merge branch 'promisesToAsyncAwaitTest' of https://github.com/elizabe…
elizabethdinella 806d14a
removed unnessecary variable declarations
elizabethdinella 4ed331e
switched to the checker function: isPromiseLike
elizabethdinella 32d07ba
Refactored the getReturnStmts function
elizabethdinella bd54e37
Added tests for arrow functions and methods
elizabethdinella 6e5b414
Merge branch 'promisesToAsyncAwaitTest' of https://github.com/elizabe…
elizabethdinella 3b69059
Fixed minor issues on tests - added async keyword to result and use l…
elizabethdinella b1f5837
Forget await keyword
elizabethdinella f324936
Refactored functionality to get variable names
elizabethdinella 2d3e5a9
Fixed small issues in tests - don't return await
elizabethdinella 3a23df8
Created clones where necessary and added support for function express…
elizabethdinella 1b72493
Added curser markers and fixed typos
elizabethdinella a4fcd03
Fixed curser marker issue
elizabethdinella cb1cfab
Removed unnessecary clones
elizabethdinella 4c5af5a
Changed wording of the diagnostic
elizabethdinella 40f136b
Refactoring based on PR comments
elizabethdinella 6856457
Changed name of file and changed diagnostic messages
elizabethdinella 8dfeac3
file name change
elizabethdinella 8b7ed24
Switched to baseline tests
elizabethdinella 9895781
Initial commit of creating new names when necessary
elizabethdinella d64ddb5
generating variable names with _1, _2, ..., _n when scopes intersect
elizabethdinella 97156d1
Fixed generating new variables to not occur when _ is used as an argu…
elizabethdinella cd0d492
Initial commit of baseline tests
elizabethdinella 588cb56
Switched to baseline tests
elizabethdinella a57c6d0
Fixed to not pass argName to different scopes (catch -> try scope)
elizabethdinella fc2c9be
Added tests for finally
elizabethdinella 7ba13d8
Fixed linting errors
elizabethdinella 28aef07
Fixed globalPromiseType bug
elizabethdinella 81cd525
Added test cases for promises in a .then() and conflicting variable n…
elizabethdinella 182648a
Cherry-pick fixes
elizabethdinella 6eef8ad
merge from master
elizabethdinella aed1c73
merge - good state
elizabethdinella b23946e
Fixed casting to use isType() functions
elizabethdinella 99bc200
initial commit of nested inner callbacks
elizabethdinella ae5efa4
initial commit of renaming before refactor
elizabethdinella a030b1e
initial commit of renaming using getSynthesizedDeepClone
elizabethdinella 209a14f
Fixed finding inner promises bug
elizabethdinella 2e470cd
First commit of conflicting var names working
elizabethdinella bc618d5
added synthesized variable decl names to the varNamesMap
elizabethdinella 13fefe6
Fixed synthesizing new variable declaration names after renames
elizabethdinella f3dafad
Fixed synthMap to have the correct values
elizabethdinella fe1c20c
Fixed inner promise returning bug
elizabethdinella 7e0c435
Added more tests
elizabethdinella 0eb995e
More tests
elizabethdinella 7d89e1e
Initial commit of checking for more to refactor in arrow function body
elizabethdinella 78e6dd7
Buggy commit -> removed returns from arrow function body
elizabethdinella 563d7b7
Added new baselines
elizabethdinella 84139b6
Fixed nextDotThen bug
elizabethdinella 9acf608
Fixed to no longer rename function names -> instead rename local and …
elizabethdinella e6bcadd
Merge branch 'promisesToAsyncAwaitCodeFix' of https://github.com/eliz…
elizabethdinella 2a98d64
Fixed getNextDotThen logic
elizabethdinella 2b31faa
Added tests and baselines
elizabethdinella 70d4173
Added tests and baselines
elizabethdinella d0d4aff
Initial buggy commit of returning vars that have callbacks elsewhere
elizabethdinella b88022b
More progress on returning variables that reference promises
elizabethdinella 71f9419
Returning variables that hold promises with callbacks working in simp…
elizabethdinella 08dd6a2
Added tests and baselines
elizabethdinella 4e7a1c0
Added functionality to glue multiple callbacks together and refactor
elizabethdinella 67275d8
Added tests and baseliens
elizabethdinella f00af95
Fixed linting errors
elizabethdinella ac1046b
Initial commit of buggy passing node flags
elizabethdinella 607aded
new strategy for getting next dot then and fixed bugs in gluing toget…
elizabethdinella 404705b
Fixed more bugs in gluing expressions together
elizabethdinella 26f3787
Initial commit of multiple var decls to refactor
elizabethdinella 50c6b4a
Fixed expression statement bug
elizabethdinella eae41dd
Added a flag for a last line return stmt
elizabethdinella 627ac68
Fixed replacing nodes and bug in collecting exprs of the same var name
elizabethdinella 82bc741
Added tests and baselines
elizabethdinella 6b25e01
Fixed small bug with seperating vars
elizabethdinella 18e18d8
Initial commit of preserving node flags on declarations (var, let, co…
elizabethdinella c90ce2c
Added tests and baselines
elizabethdinella dbf7928
More work on returning variables that hold promises
elizabethdinella 3088e43
Fixed assignment exprsesions
elizabethdinella 963a759
edited tests and added baselines
elizabethdinella c2879de
Fixed node flags bug
elizabethdinella b446923
Fixed var decl lists with multiple var decls
elizabethdinella 3cf0dfd
Added baselines
elizabethdinella 9e3302e
Keep track of last ret statement
elizabethdinella 2b04c4a
Reuse variable declarations if possible. Fixed some linting errors
elizabethdinella d3d43d3
Fixed catch returns
elizabethdinella 99320bc
Added baselines
elizabethdinella 5989e3a
Fixed checks for no prevArg
elizabethdinella 136e2f3
Added baselines
elizabethdinella 4d9584d
Fixed check for arg name bug
elizabethdinella 1ea6daf
Removed all refactoring for variable returns without direct callbacks
elizabethdinella c71c5a5
Removed uneccesary argument to getCallbackBody
elizabethdinella c374480
More code cleanup
elizabethdinella 5065ce9
Fixed lint errors
elizabethdinella d9597f0
Adjusted unit tests to match new spec that does not provide refactor …
elizabethdinella 366b812
Fixed dummy identifier bug
elizabethdinella 15249e1
Fixed the way we replace nodes
elizabethdinella cb98743
Added tests and baselines
elizabethdinella 02c37d9
Fixed PR comments
elizabethdinella 4f26e8c
Removed duplicate message
elizabethdinella 8ba2097
Fixed tests to include promise libraries
elizabethdinella 906b2ff
Refactored to use exposed getPromisedTypeOfPromise
elizabethdinella ccca0c0
Fixed rename bugs
elizabethdinella f0e1ff4
Fixed parseCallback failure cases
elizabethdinella 64b1276
Added tests and baselines
elizabethdinella d3f125a
Fixed variable name bugs
elizabethdinella ebd69f2
Fixed renames
elizabethdinella b39772d
fixed linting errors and code review nits
elizabethdinella db243ad
Fixed arrow function implicit return bug
elizabethdinella 9e548a0
Cleaned up baselines and fixed test linting errors
elizabethdinella fd7977b
Initial commmit of consts
elizabethdinella 994c5e7
Modified tests to allow for consts
elizabethdinella 5b32226
Addressed code review feedback
elizabethdinella aa41e2f
Fixed bug - now preserves innner callback statements that do not need…
elizabethdinella 41f0bb8
Fixed linting errors
elizabethdinella 35b9638
addressed more code review comments
elizabethdinella 4d8f6d2
Updated tests
elizabethdinella cf331b4
Removed calling checker.getTypeAtLocation() from suggestion diags
elizabethdinella 60ababa
added internal tags
elizabethdinella d472124
Switched to use SynthIdentifier type
elizabethdinella 6c7a10c
Added a transformer class
elizabethdinella 774aece
Removed export of custom type
elizabethdinella b73bb55
Cleaned up tests
elizabethdinella 87dd683
Removed unnecessary file
elizabethdinella 1a4eb08
Added seperate variables for synthesized uses and original uses, fixe…
elizabethdinella de28298
Cleaned up baselines
elizabethdinella 32d9bae
Addressed code review comments
elizabethdinella 5c01d7b
refactored getSynthesizedDeepClone
elizabethdinella 57b7ad2
Fixed linting errors
elizabethdinella 9d6a0e6
Switched transformer to an interface instead of a class
elizabethdinella 8f9e306
refactored lastDotThen function to make more sense
elizabethdinella 16fc028
Don't reuse variable declarations
elizabethdinella d1d5e76
Replace nodes immediately as you refactor
elizabethdinella 794c52b
Added comments and addressed code review comments
elizabethdinella 9bc4aa5
Fixed deep clone function to take a calback
elizabethdinella e8a6fb9
Addressed more code review comments - removed tuples
elizabethdinella 55d4cad
Addressed more code review comments - removed unecessary helper function
elizabethdinella 1cfee77
Refactored renameCollidingVarNames to be mroe readable
elizabethdinella a17738d
More refactoring on renameCollidingVariables to make it more readable
elizabethdinella 0f4d97c
Initial commit of synthesizing a type for code paths
elizabethdinella 52b7c96
Addressed code review comments - removed all instances of the incorre…
elizabethdinella bb6b869
Second commit of synthesized type
elizabethdinella f41da80
Added tests and baselines
elizabethdinella 2d21376
More tests and baselines
elizabethdinella af20f70
fixed const bug and updated tests accordingly
elizabethdinella e36b55a
Changed the way we get the union type
elizabethdinella 31e5433
Added more tests and baselines
elizabethdinella 39ba3ea
Fixed linting errors
elizabethdinella 8777657
Addressed code review comments and removed extraneous comments
elizabethdinella e6c676e
Added tests and baselines
elizabethdinella 25edf4c
Merged with master
elizabethdinella 54b6f2a
Addressed code review comments
elizabethdinella e2c02d6
Created a rename synthesized deep clone function and addressed other …
elizabethdinella 1e72a46
addressed more code review comments
elizabethdinella ee994f1
code review changes
elizabethdinella 8bcac69
added tests and baselines
elizabethdinella 05cb7bf
Got rid of unnecessary function and fixed linting errors
elizabethdinella 12bd6fc
Fixed linting error
elizabethdinella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
mark this as
/** @internal */