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

Issue 1657783002: Gracefully handle syntax errors in Parser::PatternRewriter. (Closed)

Created:
4 years, 10 months ago by vogelheim
Modified:
4 years, 10 months ago
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

Gracefully handle syntax errors in Parser::PatternRewriter. PatternRewriter handles certain error cases with UNREACHABLE(). Apparently, RewriteDestructuringAssignment assumes syntax checking has been done, so it's ok in this case. But DeclareAndInitializeVariables is meant to report errors to the user, so that's rather inappropriate. We leave the 1st case as a CHECK, but the 2nd will now report a syntax error. R=jochen@chromium.org, rossberg@chromium.org BUG=chromium:582626 LOG=Y

Patch Set 1 #

Patch Set 2 : Unit test. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -2 lines) Patch
M src/parsing/parser.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/parsing/pattern-rewriter.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 1 chunk +22 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
vogelheim
@Andreas, do you have suggestion on what the proper error message should be? Not quite ...
4 years, 10 months ago (2016-02-01 17:13:27 UTC) #1
adamk
Can you CC me on the bug? In general the design of the pattern-rewriter is ...
4 years, 10 months ago (2016-02-01 19:43:38 UTC) #3
vogelheim
On 2016/02/01 19:43:38, adamk wrote: > Can you CC me on the bug? Done. > ...
4 years, 10 months ago (2016-02-01 20:41:45 UTC) #4
caitp (gmail)
On 2016/02/01 20:41:45, vogelheim wrote: > On 2016/02/01 19:43:38, adamk wrote: > > Can you ...
4 years, 10 months ago (2016-02-01 20:53:20 UTC) #5
caitp (gmail)
On 2016/02/01 20:53:20, caitp wrote: > On 2016/02/01 20:41:45, vogelheim wrote: > > On 2016/02/01 ...
4 years, 10 months ago (2016-02-01 21:01:49 UTC) #6
caitp (gmail)
4 years, 10 months ago (2016-02-01 21:04:05 UTC) #7
On 2016/02/01 21:01:49, caitp wrote:
> On 2016/02/01 20:53:20, caitp wrote:
> > On 2016/02/01 20:41:45, vogelheim wrote:
> > > On 2016/02/01 19:43:38, adamk wrote:
> > > > Can you CC me on the bug?
> > > 
> > > Done.
> > > 
> > > > In general the design of the pattern-rewriter is that it's an internal
> error
> > > to
> > > > pass it an invalid pattern AST, so I'm a little concerned we're papering
> > over
> > > > something with this patch.
> > > 
> > > That's good feedback. I "guessed" the error handling strategy from the
> "bool*
> > > ok" parameter, and it's quite possible I guessed wrong. Since we do end up
> in
> > > the UNREACHABLE() cases for invalid ASTs... what would be the right place
to
> > > check for those errors?
> > 
> > Judging from the test, it looks like there are some RecordPatternError()
calls
> > missing in ParseArrayLiteral and ParsePropertyDefinition
> 
> er, not in those functions, it's in ParsePrimaryExpression

```
        classifier->RecordExpressionError(scanner()->location(),
                                          MessageTemplate::kUnexpectedToken,
                                          Token::String(Token::ELLIPSIS));
        classifier->RecordNonSimpleParameter();
        ExpressionT expr =
            this->ParseAssignmentExpression(true, classifier, CHECK_OK);
        // Missing CheckDestructuringElement() here
```

Powered by Google App Engine
This is Rietveld 408576698