Bug 136304 - Deconstruction object pattern node emits the wrong start/end text positions
Summary: Deconstruction object pattern node emits the wrong start/end text positions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-27 13:28 PDT by Saam Barati
Modified: 2014-08-27 15:34 PDT (History)
3 users (show)

See Also:


Attachments
patch (5.33 KB, patch)
2014-08-27 14:22 PDT, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2014-08-27 13:28:01 PDT
Consider the program:
var {x, y} = {x:20, y:50};


If looking at the start/end positions for the binding nodes representing x and y, they will be wrong.
"x"s position will be at the first comma
"y"s position will be at the first closing brace.

This has to do with Parser::createBindingPattern will consume the location from m_token, but at this point, m_token is on the comma/closing brace.

createBindingPattern should probably accept a token as its input for which it will get token location information.
Comment 1 Saam Barati 2014-08-27 14:22:26 PDT
Created attachment 237252 [details]
patch

Fixes the problem by caching the JSToken before attempting
to parse an optional colon.
Comment 2 Geoffrey Garen 2014-08-27 14:57:38 PDT
Comment on attachment 237252 [details]
patch

r=me
Comment 3 WebKit Commit Bot 2014-08-27 15:34:19 PDT
Comment on attachment 237252 [details]
patch

Clearing flags on attachment: 237252

Committed r173026: <http://trac.webkit.org/changeset/173026>
Comment 4 WebKit Commit Bot 2014-08-27 15:34:22 PDT
All reviewed patches have been landed.  Closing bug.