Bug 141215

Summary: Web Inspector: merge in upstream Esprima to support parsing more of ES6
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, joepeck, jonowells, mattbaker, nvasilyev, saam, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
patch
none
patch timothy: review+

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
<rdar://problem/19707119>
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.

https://github.com/jquery/esprima/tree/harmony
Comment 3 Saam Barati 2015-02-04 16:53:08 PST
Created attachment 246068 [details]
patch

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]
patch
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]
patch

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:
http://trac.webkit.org/changeset/180388