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 section - Find identifiers with same symbol #3

Merged
merged 4 commits into from
Jan 3, 2020

Conversation

bendtherules
Copy link
Contributor

Related to #2 .

  • Added little note on how to think about symbols and identifiers
  • Showed mini example because its just strict equality check
  • Added full example which logs when it finds identifiers with the same symbol.
  • Updated section title and link in TOC

@bendtherules bendtherules changed the title Add section - Check identifiers with same symbol Add section - Find identifiers with same symbol Jan 2, 2020

Then, the linker runs through these identifiers and connects the identifiers referring to the same variable with a common symbol (while considering scope and shadowing). Think of symbols as what we intuitively think as variables.

So, to check if two identifiers refer to the same symbol - just get the symbols related to the identifier and check if they are the same (by reference).
Copy link
Owner

Choose a reason for hiding this comment

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

if an identifier is not referenced typeChecker.getSymbolAtLocation(node) would return undefined yeah? should we mention that? 😄

@bendtherules
Copy link
Contributor Author

bendtherules commented Jan 3, 2020 via email

@itsdouges
Copy link
Owner

cool thanks for the explanation :)

@itsdouges itsdouges merged commit 0233b49 into itsdouges:master Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants