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

Issue 11783089: Fix VariableDefinitions.endToken for formal parameters. (Closed)

Created:
7 years, 11 months ago by Johnni Winther
Modified:
7 years, 10 months ago
Reviewers:
ahe, ngeoffray
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix VariableDefinitions.endToken for formal parameters. This makes the end token point to that parameter name instead of the next token (comma or right parenthesis). I could not find a way to test the unparsing of a parameter outside its context, that is outside the parameter list it resides in. All tests unparser(2)_test test parameters in their context. Token positions for operator - arity checks updated now that parameter positions are precise. Committed: https://code.google.com/p/dart/source/detail?r=17705 Committed: https://code.google.com/p/dart/source/detail?r=18120

Patch Set 1 #

Total comments: 1

Patch Set 2 : Test added to unparser_test. #

Total comments: 10

Patch Set 3 : Updated cf. comments. #

Total comments: 10

Patch Set 4 : Rebased #

Patch Set 5 : VariableDefinitions.endToken removed. #

Patch Set 6 : Rebased #

Patch Set 7 : Handle for-in. #

Total comments: 4

Patch Set 8 : Rebased #

Patch Set 9 : Updated cf. comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+117 lines, -35 lines) Patch
M sdk/lib/_internal/compiler/implementation/dart_backend/utils.dart View 1 2 3 4 1 chunk +1 line, -2 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/resolution/members.dart View 1 2 3 4 5 2 chunks +29 lines, -3 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/scanner/listener.dart View 1 2 3 4 5 6 chunks +10 lines, -10 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/scanner/parser.dart View 1 2 3 4 5 6 7 8 5 chunks +35 lines, -11 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/tree/nodes.dart View 1 2 3 4 2 chunks +2 lines, -4 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/tree/unparser.dart View 1 2 3 4 5 6 2 chunks +1 line, -4 lines 0 comments Download
M tests/compiler/dart2js/resolver_test.dart View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M tests/compiler/dart2js/unparser_test.dart View 1 2 2 chunks +38 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Johnni Winther
7 years, 11 months ago (2013-01-10 14:08:48 UTC) #1
ngeoffray
DBC https://codereview.chromium.org/11783089/diff/1/sdk/lib/_internal/compiler/implementation/resolution/members.dart File sdk/lib/_internal/compiler/implementation/resolution/members.dart (right): https://codereview.chromium.org/11783089/diff/1/sdk/lib/_internal/compiler/implementation/resolution/members.dart#newcode639 sdk/lib/_internal/compiler/implementation/resolution/members.dart:639: if (isMinus || // Point to the parameter ...
7 years, 11 months ago (2013-01-10 14:20:52 UTC) #2
ahe
How about: testUnparseVariableDeclaration(String type, String variables) { VariableDefinitions node = parseStatement('$type$variables'); Expect.equals(variables, unparse(node.definitions)); }
7 years, 11 months ago (2013-01-10 15:00:46 UTC) #3
Johnni Winther
PTAL Test added.
7 years, 11 months ago (2013-01-11 12:51:02 UTC) #4
ahe
Don't understand the isMinus parameter. Concerned about loss of test coverage from marking unparser test ...
7 years, 11 months ago (2013-01-21 11:14:08 UTC) #5
Johnni Winther
PTAL https://codereview.chromium.org/11783089/diff/5001/sdk/lib/_internal/compiler/implementation/resolution/members.dart File sdk/lib/_internal/compiler/implementation/resolution/members.dart (right): https://codereview.chromium.org/11783089/diff/5001/sdk/lib/_internal/compiler/implementation/resolution/members.dart#newcode639 sdk/lib/_internal/compiler/implementation/resolution/members.dart:639: if (isMinus || // Point to the parameter ...
7 years, 11 months ago (2013-01-22 15:57:30 UTC) #6
ahe
LGTM, but I have a suggestion that I think would simplify endToken handling in VariableDefinitions. ...
7 years, 11 months ago (2013-01-23 11:26:35 UTC) #7
Johnni Winther
https://codereview.chromium.org/11783089/diff/14001/sdk/lib/_internal/compiler/implementation/scanner/listener.dart File sdk/lib/_internal/compiler/implementation/scanner/listener.dart (right): https://codereview.chromium.org/11783089/diff/14001/sdk/lib/_internal/compiler/implementation/scanner/listener.dart#newcode1243 sdk/lib/_internal/compiler/implementation/scanner/listener.dart:1243: NodeList variables = makeNodeList(count, null, null, ","); On 2013/01/23 ...
7 years, 10 months ago (2013-01-28 12:23:24 UTC) #8
Johnni Winther
PTAL Updated to handle for-in by only including trailing semicolons in statements.
7 years, 10 months ago (2013-02-04 08:22:17 UTC) #9
ahe
LGTM! Nice. I created a mess initially. I should have had the unparser from the ...
7 years, 10 months ago (2013-02-04 13:38:26 UTC) #10
Johnni Winther
7 years, 10 months ago (2013-02-05 09:03:08 UTC) #11
https://codereview.chromium.org/11783089/diff/28001/sdk/lib/_internal/compile...
File sdk/lib/_internal/compiler/implementation/scanner/parser.dart (right):

https://codereview.chromium.org/11783089/diff/28001/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/scanner/parser.dart:558:
identical(value, token.stringValue);
On 2013/02/04 13:38:26, ahe wrote:
> Since it doesn't fit on one line, I'd prefer using { return ... }.

Done.

https://codereview.chromium.org/11783089/diff/28001/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/scanner/parser.dart:1905:
expectSemicolon(token);
On 2013/02/04 13:38:26, ahe wrote:
> I have a prototype that recovers on missing semicolons, and this version
should
> just work:
> 
> Token semicolon = token;
> token = expectSemicolon(token);
> listener.endVariablesDeclaration(count, semiColon);
> return token;
> 
> In particular, it is important that we let expectSemicolon control what the
next
> token is.

Done.

Powered by Google App Engine
This is Rietveld 408576698