Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Issue 2133543003: [parser] report errors for invalid binding patterns in async formal parameters (Closed)

Created:
4 years, 5 months ago by caitp
Modified:
3 years, 10 months ago
Reviewers:
nickie, Dan Ehrenberg
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[parser] report errors for invalid binding patterns in async formal parameters BUG=v8:4483, v8:5190 R=littledan@chromium.org, nikolaos@chromium.org

Patch Set 1 #

Total comments: 15

Patch Set 2 : fixup #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -24 lines) Patch
M src/parsing/expression-classifier.h View 1 chunk +13 lines, -0 lines 0 comments Download
M src/parsing/parser-base.h View 1 8 chunks +56 lines, -24 lines 1 comment Download
M test/cctest/test-parsing.cc View 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (3 generated)
caitp (gmail)
PTAL (sorry for the noise with this CL, I am not happy with depot-tools-auth at ...
4 years, 5 months ago (2016-07-08 17:51:48 UTC) #2
nickie
LGTM, modulo my two comments. https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h#newcode926 src/parsing/parser-base.h:926: if (!classifier->is_valid_binding_pattern()) { Is ...
4 years, 5 months ago (2016-07-11 13:19:51 UTC) #5
caitp
Thanks. I think Dan is working on an alternative approach, which is simpler/less of a ...
4 years, 5 months ago (2016-07-11 13:24:42 UTC) #6
caitp
Thanks. I think Dan is working on an alternative approach, which is simpler/less of a ...
4 years, 5 months ago (2016-07-11 13:24:44 UTC) #7
nickie
https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h#newcode926 src/parsing/parser-base.h:926: if (!classifier->is_valid_binding_pattern()) { On 2016/07/11 13:24:42, caitp wrote: > ...
4 years, 5 months ago (2016-07-11 13:32:18 UTC) #8
Dan Ehrenberg
https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h#newcode2351 src/parsing/parser-base.h:2351: if (merge_patterns) { I find this logic of when ...
4 years, 5 months ago (2016-07-11 23:22:47 UTC) #9
caitp
https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h#newcode2351 src/parsing/parser-base.h:2351: if (merge_patterns) { On 2016/07/11 23:22:47, Dan Ehrenberg wrote: ...
4 years, 5 months ago (2016-07-11 23:32:25 UTC) #10
Dan Ehrenberg
https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h#newcode2351 src/parsing/parser-base.h:2351: if (merge_patterns) { On 2016/07/11 23:32:24, caitp wrote: > ...
4 years, 5 months ago (2016-07-11 23:37:57 UTC) #11
nickie
https://codereview.chromium.org/2133543003/diff/20001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2133543003/diff/20001/src/parsing/parser-base.h#newcode901 src/parsing/parser-base.h:901: !this->IsIdentifier(expr)) { Merging the conditions and removing the "else" ...
4 years, 5 months ago (2016-07-12 12:27:13 UTC) #12
nickie
https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h#newcode2351 src/parsing/parser-base.h:2351: if (merge_patterns) { On 2016/07/11 23:37:57, Dan Ehrenberg wrote: ...
4 years, 5 months ago (2016-07-12 13:11:54 UTC) #13
caitp
4 years, 5 months ago (2016-07-12 14:38:31 UTC) #14
https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h
File src/parsing/parser-base.h (right):

https://codereview.chromium.org/2133543003/diff/1/src/parsing/parser-base.h#n...
src/parsing/parser-base.h:2351: if (merge_patterns) {
On 2016/07/12 13:11:53, nickie wrote:
> On 2016/07/11 23:37:57, Dan Ehrenberg wrote:
> > On 2016/07/11 23:32:24, caitp wrote:
> > > On 2016/07/11 23:22:47, Dan Ehrenberg wrote:
> > > > I find this logic of when to merge_patterns to be really confusing.
Maybe
> > > better
> > > > to notice the binding pattern error when it's generated, rather than
> > > propagating
> > > > it like this and noticing it later. I tried that approach out at
> > > > https://codereview.chromium.org/2139063002/ .
> > > 
> > > That doesn't really work, because then we could fail when parsing
> > > `async(<assignment pattern>);` for no real reason...
> > 
> > I don't understand the issue. The binding pattern is only checked if it's
> > followed by an arrow (the same case for turning it into a comma expression).
> Do
> > you have a test case in mind?
> 
> I tried the following with Dan's patch and they seem to work fine, so I don't
> understand what Caitlin suggests here.
> 
> d8> function async(x) { print("async", x, "FTW!"); }
> d8> var await=42;
> 
> d8> f = async(1);
> async 1 FTW!
> 
> d8> f = async(x=1);
> async 1 FTW!
> 
> d8> f = async([x,y]=[1,2]);
> async 1,2 FTW!
> 
> d8> async(x=1);
> async 1 FTW!
> 
> d8> async([x,y]=[1,2]);
> async 1,2 FTW!
> 
> d8> async(await);
> async 42 FTW!
> 
> d8> async(await=17);
> async 17 FTW!

What are either of you even talking about? Using plain english, what he
suggested does not work. What he implements in his patch is different from what
he suggested here --- so that's besides the point. Anyways, his patch works,
cool, lets do it.

Powered by Google App Engine
This is Rietveld 408576698