Bug 141215 - Web Inspector: merge in upstream Esprima to support parsing more of ES6
Summary: Web Inspector: merge in upstream Esprima to support parsing more of ES6
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Saam Barati
Keywords: InRadar
Depends on:
Reported: 2015-02-03 15:19 PST by Brian Burg
Modified: 2015-02-19 22:35 PST (History)
8 users (show)

See Also:

patch (199.46 KB, patch)
2015-02-04 16:53 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch (210.83 KB, patch)
2015-02-10 18:52 PST, Saam Barati
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Burg 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
Comment 1 Radar WebKit Bug Importer 2015-02-03 15:20:50 PST
Comment 2 Saam Barati 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.

Comment 3 Saam Barati 2015-02-04 16:53:08 PST
Created attachment 246068 [details]

almost there.
Comment 4 Saam Barati 2015-02-04 17:00:51 PST
what is left:
1. Run tests
2. Write more tests.
Comment 5 Saam Barati 2015-02-10 18:52:18 PST
Created attachment 246365 [details]
Comment 6 Saam Barati 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.
Comment 7 Timothy Hatcher 2015-02-18 14:34:39 PST
Comment on attachment 246365 [details]

Looks good. Nice use of Symbol. We should consider it for all our enums.
Comment 8 Saam Barati 2015-02-19 22:35:09 PST
landed in: