Skip to content
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

Add getOrUpdate helper #10436

Closed
wants to merge 2 commits into from
Closed

Add getOrUpdate helper #10436

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 19, 2016

No description provided.

@ghost ghost force-pushed the getOrUpdate branch from 38b6195 to e0e5afc Compare August 19, 2016 14:39
@ghost ghost assigned rbuckton Aug 19, 2016
@@ -326,7 +326,7 @@ namespace ts {
// Otherwise, we'll be merging into a compatible existing symbol (for example when
// you have multiple 'vars' with the same name in the same container). In this case
// just add this node into the declarations list of the symbol.
symbol = symbolTable[name] || (symbolTable[name] = createSymbol(SymbolFlags.None, name));
symbol = getOrUpdate(symbolTable, name, () => createSymbol(SymbolFlags.None, name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oddly enough, I had removed this exact function to avoid the closure on this line.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 14, 2016

what is the reason for this change?

@ghost
Copy link
Author

ghost commented Sep 15, 2016

Just a pattern I noticed while going through uses of maps.

@ghost
Copy link
Author

ghost commented Oct 7, 2016

This is now part of #11354

@ghost ghost closed this Oct 7, 2016
@mhegazy mhegazy deleted the getOrUpdate branch November 2, 2017 21:03
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants