Repository navigation
Fix cross-file merge of assignment decl valueDeclaration - #26918
Merged
Nathan Shively-Sanders (sandersn) merged 5 commits intoSep 16, 2018
Merged
Nathan Shively-Sanders (sandersn) merged 5 commits into
Nathan Shively-Sanders (sandersn) merged 5 commits into
Conversation
Previously mergeSymbol in the checker always updated valueDeclaration if target.valueDeclaration was an assignment declaration. The binder only updates target.valueDeclaration if it is an assignment declaration and source.valueDeclaration is *not* an assignment declaration. Now the checker behaves the same way as the binder.
Nathan Shively-Sanders (sandersn)
requested review from
Ryan Cavanaugh (RyanCavanaugh) and
Wesley Wigham (weswigham)
September 5, 2018 20:04
Member
|
Baseline diff in jsContainerMergeJsContainer on CI |
Wesley Wigham (weswigham)
approved these changes
Sep 14, 2018
Makes commonjs merge with globals when appropriate.
| /** CommonJS is *almost* a module -- no merges -- except that assignment declarations need to merge with globals. */ | ||
| function mergeCommonJsSymbolTable(target: SymbolTable, source: SymbolTable) { | ||
| source.forEach((sourceSymbol, id) => { | ||
| if (target.has(id) && sourceSymbol.flags & SymbolFlags.Assignment) { |
Member
Author
There was a problem hiding this comment.
Talking with Wesley Wigham (@weswigham), he pointed out that it would be better to store all the identifier-unbound declarations in a separate per-file commonJSGlobalAugmentations property that gets merged into globals instead of trying to filter here (there are plenty of symbols marked with Assignment that shouldn't necessarily merge with globals).
Instead of trying to filter these augmentations out of the normal symbol table of commonjs modules.
Member
Author
|
All right, the new table is in. I dropped the "common" part since all JS files create global augmentations, and they all need to be merged, regardless of whether they are in a commonJS module. |
Wesley Wigham (weswigham)
approved these changes
Sep 15, 2018
Nathan Shively-Sanders (sandersn)
deleted the
fix-assignment-decl-cross-file-merge
branch
September 16, 2018 14:46
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.
Previously mergeSymbol in the checker always updated valueDeclaration if target.valueDeclaration was an assignment declaration. The binder only updates target.valueDeclaration if it is an assignment declaration and source.valueDeclaration is not an assignment declaration.
Now the checker behaves the same way as the binder.
Fixes #26877