| Summary: | Deleting a quote can cause the whole file to go red... | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Eric Moffatt <emoffatt> | ||||||
| Component: | JS Tools | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | curtis.windatt.public, Michael_Rennie, Olivier_Thomann, steve_northover | ||||||
| Version: | 12.0 | ||||||||
| Target Milestone: | 13.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Note that the same effect can be induced by deleting any of: { } ( ) [ ] ' ".
This comes from the new rule "no-used-expressions". It should skip recovered nodes. Will fix it. Fix is trivial. Created attachment 263679 [details]
Proposed patch
Added regression test. Delivered as commit http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=dde2c84793e74cb34f025a9daa584a76f40c0246 and http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=d428b553c220e4b82522850167222b8f81d7d20c Reopen as this might also happen in a file where there is no "recovered" node. This rule should not report problem on a node that has syntax errors. I thought checking for recovered nodes would be enough, but it is not. Take the file smokeTests/large-broken.js ans remove the closing double quote on line 323. The problem still exists because none of the node in the if statement is tagged as having syntax errors. Need more work. The previous fix is not wrong. It is just not sufficient. The only way to skip this rule would to flag the ast node when a syntax error is reported inside the range of a node. This can be quite costly. Needs to be done with cautious. Ok, I found a way to handle this. If there is a syntax error, the Program node contains an error array that are the syntax errors. So if this array is not empty, I skip the no-unused-expressions check. |
Created attachment 263678 [details] This is what I see when I deleted a quote. Olivier thinks it may be due to a new rule he added and will comment