RESOLVED FIXED 141215
Web Inspector: merge in upstream Esprima to support parsing more of ES6
https://bugs.webkit.org/show_bug.cgi?id=141215
Summary Web Inspector: merge in upstream Esprima to support parsing more of ES6
Brian Burg
Reported 2015-02-03 15:19:52 PST
ScriptSyntaxTree uses Esprima, which only handles ES5 and cannot parse Web Inspector code itself (var..of). It looks like Espree is getting close to having sufficient ES6, and is compatible with Esprima AST: https://github.com/eslint/espree
Attachments
patch (199.46 KB, patch)
2015-02-04 16:53 PST, Saam Barati
no flags
patch (210.83 KB, patch)
2015-02-10 18:52 PST, Saam Barati
timothy: review+
Radar WebKit Bug Importer
Comment 1 2015-02-03 15:20:50 PST
Saam Barati
Comment 2 2015-02-03 18:32:37 PST
It looks like Esprima's harmony branch has more ES6 features than espree right now, so lets merge it in instead. We can reevaluate switching to espree later. https://github.com/jquery/esprima/tree/harmony
Saam Barati
Comment 3 2015-02-04 16:53:08 PST
Created attachment 246068 [details] patch almost there.
Saam Barati
Comment 4 2015-02-04 17:00:51 PST
what is left: 1. Run tests 2. Write more tests.
Saam Barati
Comment 5 2015-02-10 18:52:18 PST
Saam Barati
Comment 6 2015-02-10 18:54:40 PST
To note, this upstream esprima does not yet parse the following statement correctly: "for ({x,y} of foo) bar();" It only supports: "for (var {x,y} of foo) bar();" Since we're switching to a non-release build of esprima, it's probably worth merging in uptream esprima's more often. Maybe once every 3-4 weeks until they have an official ES6 release.
Timothy Hatcher
Comment 7 2015-02-18 14:34:39 PST
Comment on attachment 246365 [details] patch Looks good. Nice use of Symbol. We should consider it for all our enums.
Saam Barati
Comment 8 2015-02-19 22:35:09 PST
Note You need to log in before you can comment on or make changes to this bug.