Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 426930

Summary: Not all 'this' references are marked in an object
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public
Version: 5.0Flags: curtis.windatt.public: review+
Target Milestone: 5.0 RC1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
fix none

Description Michael Rennie CLA 2014-01-29 12:31:13 EST
Steps:
1. open occurrences.js
2. select 'this' on line 49 (or any of the this's in the enter function)
3. notice none of the 'this' occurrences are marked in enterThis, leave, leaveThis or checkId
Comment 1 Michael Rennie CLA 2014-01-29 16:46:13 EST
Looks like this could just be a scoping problem.

The following snippet marks all the 'this' values fine:

var foo = {
	bool: true,
	f1: function() {
		this.bool;
	},
	f2: function() {
		this.bool;
	},
	f3: function() {
		this.bool;
	}
};

While this one does not:

function call(arg) {}
call({
	bool: true,
	f1: function() {
		this.bool;
	},
	f2: function() {
		this.bool;
	},
	f3: function() {
		this.bool;
	}
});

looks like we are short-circuiting all the fun scope work in 'enterThis' when we encounter a call expression.
Comment 2 Michael Rennie CLA 2014-02-03 11:59:16 EST
Created attachment 239581 [details]
fix

Fixes the marking across object / call expression boundaries + adds a pile more tests
Comment 3 Curtis Windatt CLA 2014-02-03 15:30:47 EST
+1, tests cover substantially more cases and all pass.  Tested a number of cases in editorCommands where we switch between 'this' and 'self', everything looks accurate.