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

Bug 488887

Summary: [esprima] LabeledStatement does not recover correctly
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: steve_northover
Version: 11.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Rennie CLA 2016-03-02 13:28:07 EST
Consider the following snippet:

var a = { 
	p: this.g(
 	g: function (){} 
};

After we try to recover from the incomplete CallExpression 'this.g(' we end up setting null body on the resulting LabeledStatement, which violates the ESTree spec (and will cause Tern to barf out an exception). 

There are a couple of things to do here:
1. improve our recovery for invalid object property decls (see esprim.js#recoverProperty)
2. add the recoveredNode check in LabeledStatement
Comment 1 Michael Rennie CLA 2016-06-02 14:53:15 EDT
With the switch to Acorn, this is handled properly.

Closing wontfix