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

Bug 437614

Summary: No error on missing RHS of || operator
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: Michael_Rennie
Version: 5.0   
Target Milestone: 6.0 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2014-06-17 13:20:24 EDT
1. Create a new js file containing this code:

var foo, bar;
foo({
	aaa: 2 || 1,
	bbb: 2 || , // !!!!
	ccc:  bar.port,
});

2. The line with !!!! is missing the right-hand operand of the "||" expression -- this is a syntax error
3. Save the file. I expected to see an error marker, but I see none.

I briefly debugged the ASTManager, and found that esprima.parse() returns without throwing an error, and the resulting ast.errors array is empty. 

If I parse the same code using http://esprima.org/demo/parse.html I get 
> "Line 4: Unexpected token ,"
Comment 1 Michael Rennie CLA 2014-06-19 13:57:28 EDT
Its a boo boo in some of our recovery, we trap the exception from parsing the assignment (property) and continue on, without recording the error.
Comment 2 Michael Rennie CLA 2014-06-19 14:39:22 EDT
Pushed to Gerrit:

https://git.eclipse.org/r/28754