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

Issue 759183002: Fix incremental parsing of import combinators. (Closed)

Created:
6 years ago by Paul Berry
Modified:
6 years ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix incremental parsing of import combinators. This bug was discovered by the incremental parse stress tester. R=scheglov@google.com Committed: https://code.google.com/p/dart/source/detail?r=41993

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -10 lines) Patch
M pkg/analyzer/lib/src/generated/parser.dart View 5 chunks +33 lines, -10 lines 2 comments Download
M pkg/analyzer/test/generated/parser_test.dart View 2 chunks +20 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (2 generated)
Paul Berry
6 years ago (2014-11-26 04:37:01 UTC) #2
scheglov
LGTM
6 years ago (2014-11-26 04:45:44 UTC) #3
Paul Berry
Committed patchset #1 (id:1) manually as 41993 (presubmit successful).
6 years ago (2014-11-26 14:05:54 UTC) #4
Brian Wilkerson
https://codereview.chromium.org/759183002/diff/1/pkg/analyzer/lib/src/generated/parser.dart File pkg/analyzer/lib/src/generated/parser.dart (right): https://codereview.chromium.org/759183002/diff/1/pkg/analyzer/lib/src/generated/parser.dart#newcode1252 pkg/analyzer/lib/src/generated/parser.dart:1252: return _parser.parseCombinator(); Does this handle the case where one ...
6 years ago (2014-11-26 14:44:38 UTC) #6
Paul Berry
6 years ago (2014-11-26 16:08:38 UTC) #7
Message was sent while issue was closed.
https://codereview.chromium.org/759183002/diff/1/pkg/analyzer/lib/src/generat...
File pkg/analyzer/lib/src/generated/parser.dart (right):

https://codereview.chromium.org/759183002/diff/1/pkg/analyzer/lib/src/generat...
pkg/analyzer/lib/src/generated/parser.dart:1252: return
_parser.parseCombinator();
On 2014/11/26 14:44:38, Brian Wilkerson wrote:
> Does this handle the case where one combinator is split into two? For example:
> 
> import 'foo.dart' show A;
> 
> import 'foo.dart' show B, hide A;
> 
> It looks like it would only parse one of the two combinators.

Yes, it works correctly.  Note: I'm assuming you mean "import 'foo.dart' show B
hide A;".  ',' is only allowed between identifiers within a combinator, not
between combinators.

You are correct that the call to _parser.parseCombinator() only parses one of
the combinators, but that's not a problem, because when the result is returned
to IncrementalParser.reparse(), the first thing it does is to check that the new
node can replace the old node without gaining or losing tokens.  In this case,
it can't, because if "show A" is replaced by "show B", the tokens "hide A" will
be lost.  So it sets advanceToParent = true and tries again at the next level up
the parse tree.

Having said that, your example seems valuable to explicitly test.  I'll add that
test in a follow up CL.

Powered by Google App Engine
This is Rietveld 408576698