Bug 413269 - improved tolerant parsing of function bodies, loops, and conditionals
Summary: improved tolerant parsing of function bodies, loops, and conditionals
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 enhancement (vote)
Target Milestone: 4.0 M1   Edit
Assignee: Mark Macdonald CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2013-07-18 13:36 EDT by Manu Sridharan CLA
Modified: 2013-10-18 12:40 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manu Sridharan CLA 2013-07-18 13:36:38 EDT
I have a small change to improve tolerant parsing of function bodies, available in these commits:

https://github.com/msridhar/orion.client/commit/a18a0d264c0029d0d7b0f1a9d409e8ac12e04439

https://github.com/msridhar/orion.client/commit/394561f1ccb1f4a5bde0fefebae529be10c484f7


The change enables smart completion to work for the following case:

var fizzbuzz = {};

function foo() {
  if (fizz$$

With the change, smart completion is able to suggest 'fizzbuzz' when invoked where '$$' appears.  This change also works if the function body is 'for (var p in fizz$$', 'Object.keys(fizz$$', etc.  The tolerant parsing could be further improved, but even this small change catches some cases I've run into lately.

I added a test to esprimaJsContentAssistTests.js, and those tests pass.  If there are other tests I should run, please let me know.
Comment 1 Manu Sridharan CLA 2013-07-19 18:12:50 EDT
I've added more improvements to tolerant parsing on the branch:

https://github.com/msridhar/orion.client/tree/tolerant-parsing-functions

Now, the parser is better about handling missing ')' and '}' characters in various places.  I've added more tests as well.  I'll rename this bug appropriately.

Shall I rebase to master and collapse my commits into one to make merging easier?
Comment 2 Manu Sridharan CLA 2013-07-22 18:11:15 EDT
I wrote all this code, and I have the right to contribute it to Eclipse under the eclipse.org website terms of use.
Comment 3 Mark Macdonald CLA 2013-07-22 18:13:32 EDT
Thanks Manu! Pushed.

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=e0d0d4e
Comment 4 Mark Macdonald CLA 2013-07-22 18:23:48 EDT
(In reply to comment #3)
> Thanks Manu! Pushed.
> 
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/
> ?id=e0d0d4e

I pushed that commit with an incorrect Author field, so rv'd and re-commit with Author set to Manu.

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=332b538