Skip to content

added collision check for '_this' #155

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

Merged
merged 2 commits into from
Jul 21, 2014
Merged

added collision check for '_this' #155

merged 2 commits into from
Jul 21, 2014

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Jul 18, 2014

Deciding if _this in user code collides with _this that will be introduced in generated code required knowledge about arrow function that potentially reside in parts of the AST that are not yet examined. To avoid multiple tree traversals if node named _this is found - we put it in the list of candidates and process items from this list after checking of all elements in file is finished - at this moment value of NodeCheckFlags.CaptureThis is already set for all places that capture lexical this so collision check is relatively cheap.

This fixes #64

@DanielRosenwasser
Copy link
Member

Looks good to me.

@CyrusNajmabadi
Copy link
Contributor

LGTM

potentialThisCollisions.push(node);
}

// this function will run after checking the source file so 'CaptureThis' for all nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

'CaptureThis' is correct for all nodes

@JsonFreeman
Copy link
Contributor

Looks good

vladima added a commit that referenced this pull request Jul 21, 2014
added collision check for '_this'
@vladima vladima merged commit f7d7623 into master Jul 21, 2014
@vladima vladima deleted the check_this branch July 21, 2014 04:23
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
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.

[Errors] _this in reserved positions
4 participants