Skip to content

added collision check for '_this' - #155

Merged
Vladimir Matveev (vladima) merged 2 commits into
masterfrom
check_this
Jul 21, 2014
Merged

Vladimir Matveev (vladima) merged 2 commits into
masterfrom
check_this

Conversation

@vladima

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

Looks good to me.

@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

LGTM

Comment thread src/compiler/checker.ts Outdated

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Looks good

Vladimir Matveev (vladima) added a commit that referenced this pull request Jul 21, 2014
added collision check for '_this'
@vladima
Vladimir Matveev (vladima) merged commit f7d7623 into master Jul 21, 2014
@vladima
Vladimir Matveev (vladima) deleted the check_this branch July 21, 2014 04:23
@microsoft 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