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

Bug 445410

Summary: [Occurrences] Does not mark occurrence that happens in a nested scope BEFORE the declaration
Product: [ECD] Orion Reporter: Curtis Windatt <curtis.windatt.public>
Component: JS ToolsAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 6.0   
Target Milestone: 7.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 448535    

Description Curtis Windatt CLA 2014-09-29 16:05:26 EDT
f();
function g(){
  f();  // Not marked
}
function f(){}
function h(){
  f();
}
f();

No matter which occurrence of f is selected, the call inside of g() will not be marked.
Comment 1 Curtis Windatt CLA 2014-10-20 13:07:53 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=0255c555c8f6da52de979e739033d8c7078346a1
Fixed in master

If we leave a scope without having found a defining node, we add the occurrences to the parent scope.  If the defining node is found in the parent scope, the occurrences are then marked.

Doing this removes the need for a separate globals array.  As the occurrences keep getting passed up until they reach the Program scope.  If no defining node is found in the program, we can just mark everything stored in the program scope.

I also included an improvement to the test suite to print out the expected/actual occurrences.  Makes it far easier to see what is happening without debugging (especially in cases where we mark the same occurrence twice).