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

Bug 436630

Summary: Occurrences are not marked in with or for-in statements
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact: Curtis Windatt <curtis.windatt.public>
Severity: normal    
Priority: P3 CC: curtis.windatt.public, mamacdon
Version: unspecified   
Target Milestone: 6.0 RC1   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Michael Rennie CLA 2014-06-04 16:21:03 EDT
var foo = 10;
with(foo) {
 console.log('with');
}

select foo - the occurrence in the with statement is not marked
Comment 1 Mark Macdonald CLA 2014-06-04 17:01:50 EDT
Is the goal here to mark occurrences only in the "object" of the WithStatement? Or are you thinking about wading into the swamp within the curly braces too?
Comment 2 Michael Rennie CLA 2014-06-05 11:38:07 EDT
(In reply to Mark Macdonald from comment #1)
> Is the goal here to mark occurrences only in the "object" of the
> WithStatement? Or are you thinking about wading into the swamp within the
> curly braces too?

The goal is to mark all of them. We already mark inside the body, but we do not check the actual WithStatement node itself. The fix is really small, something like:

case Estraverse.Syntax.WithExpression:
  this.checkId(node.object);
  break;
Comment 3 Michael Rennie CLA 2014-06-05 12:24:35 EDT
(In reply to Michael Rennie from comment #2)

> case Estraverse.Syntax.WithExpression:
>   this.checkId(node.object);
>   break;

We also don't support the ForInStatement node

case Estraverse.Syntax.ForInStatement:
   this.checkId(node.left);
   this.checkId(node.right);
   break;