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

Bug 466507

Summary: [parse] If a fatal error is thrown from Esprima it can cause a null AST for Tern
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 8.0   
Target Milestone: 9.0   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Rennie CLA 2015-05-06 00:21:39 EDT
The code added in infer.js does not handle the case of a fatal error being thrown from Esprima.

Consider the following snippet:

function

will throw an error resulting in a null AST, which will cause Tern to later throw an exception.

Until we decide how to have Tern use the astManager (since Tern has no support for promises), we will have to patch it to create the default empty AST and serialize the errors.