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

Bug 493082

Summary: [ecma6] imports statements are causing an assert error in escope code
Product: [ECD] Orion Reporter: Olivier Thomann <Olivier_Thomann>
Component: JS ToolsAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 11.0   
Target Milestone: 12.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Olivier Thomann CLA 2016-05-05 10:39:07 EDT
The code in escope.js line 1347 is causing an assert error if the ecma version is not 6 or above and the sourceType is not module.
The problem with this is that the user can start its file with an import statement before setting the proper values to ecmaVersion or sourceType in its .tern-project file. Because we fail while traversing the file, we never report the error on the import keyword.
Bug 490642 provides a quickfix to update ecmaVersion and sourceType when export or import are encountered. It works fine for export because escope has no assert in this case.
Comment 1 Olivier Thomann CLA 2016-05-05 10:46:04 EDT
I think we have two things we need to fix here:
1) the scope manager should be properly initialized with the values of ecmaVersion and sourceType set in the .tern-project file.
2) We should remove the assert in escope.js because with it, there is no way the user can get the error and use the quickfix from bug 490642 to fix it. If we don't remove the assert statement, we need a way to expose this error to the user or skip it if they are syntax errors inside the ast. When the scope manager fails, the ast already exists. So we could skip the eslint resolution on the tree to show the errors that we already have.
Comment 2 Olivier Thomann CLA 2016-05-05 17:11:58 EDT
Delivered. commit: b6a877ffea80f743e44d8850300f4f0aefcf09a7