| Summary: | [esprima] Esprima parser recovery fails before for loop | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Ashwin Baliga <ashbaliga> |
| Component: | JS Tools | Assignee: | Michael Rennie <Michael_Rennie> |
| Status: | RESOLVED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ken_walker |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
The problem is that we are completely failing to recover in this case. > var abc=20; > abc.| <-- code assist here > while(true) > { > } In this case we get an AST rooted as: VariableDeclaration ExpressionStatement WhileStatement OK - this is the expected AST > But in the following case, number properties are not shown: > > var abc=20; > abc.| <-- code assist here > for(;;) > { > } In this case we get an AST rooted as: VariableDeclaration ExpressionStatement ExpressionStatement WRONG - third root should be ForStatement, there are also a bunch of (what look like) cascading syntax errors: Syntax error on token ';', delete this token. Syntax error on token ')', delete this token. Syntax error on token '{', delete this token. (In reply to Michael Rennie from comment #1) > The problem is that we are completely failing to recover in this case. > > > var abc=20; > > abc.| <-- code assist here > > while(true) > > { > > } > > In this case we get an AST rooted as: > > VariableDeclaration > ExpressionStatement > WhileStatement > > OK - this is the expected AST This is actually the 'no errors' AST, I grabbed the shot of it just prior to the re-parse. The actual rooted AST for the while-case is: VariableDeclaration ExpressionStatement CallExpression ExpressionStatement Now that we use Acorn as our base parser this is working as expected. Closing worksforme. |
In the following JavaScript file, code assist works and shows number properties correctly: var abc=20; abc.| <-- code assist here while(true) { } But in the following case, number properties are not shown: var abc=20; abc.| <-- code assist here for(;;) { }