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

Side by Side Diff: pkg/compiler/lib/src/parser/partial_parser.dart

Issue 2016693002: Correctly skip if-null expressions. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/language/regress_26543_1_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.parser.partial; 5 library dart2js.parser.partial;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../options.dart' show ParserOptions; 8 import '../options.dart' show ParserOptions;
9 import '../util/characters.dart' as Characters show $CLOSE_CURLY_BRACKET; 9 import '../util/characters.dart' as Characters show $CLOSE_CURLY_BRACKET;
10 import '../tokens/token.dart' show BeginGroupToken, ErrorToken, Token; 10 import '../tokens/token.dart' show BeginGroupToken, ErrorToken, Token;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if ((identical(kind, Tokens.EOF_TOKEN)) || 42 if ((identical(kind, Tokens.EOF_TOKEN)) ||
43 (identical(value, ';')) || 43 (identical(value, ';')) ||
44 (identical(value, ',')) || 44 (identical(value, ',')) ||
45 (identical(value, '}')) || 45 (identical(value, '}')) ||
46 (identical(value, ')')) || 46 (identical(value, ')')) ||
47 (identical(value, ']'))) { 47 (identical(value, ']'))) {
48 break; 48 break;
49 } 49 }
50 if (identical(value, '=') || 50 if (identical(value, '=') ||
51 identical(value, '?') || 51 identical(value, '?') ||
52 identical(value, ':')) { 52 identical(value, ':') ||
53 identical(value, '??')) {
53 var nextValue = token.next.stringValue; 54 var nextValue = token.next.stringValue;
54 if (identical(nextValue, 'const')) { 55 if (identical(nextValue, 'const')) {
55 token = token.next; 56 token = token.next;
56 nextValue = token.next.stringValue; 57 nextValue = token.next.stringValue;
57 } 58 }
58 if (identical(nextValue, '{')) { 59 if (identical(nextValue, '{')) {
59 // Handle cases like this: 60 // Handle cases like this:
60 // class Foo { 61 // class Foo {
61 // var map; 62 // var map;
62 // Foo() : map = {}; 63 // Foo() : map = {};
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return token; 168 return token;
168 } 169 }
169 return listener.unexpected(token); 170 return listener.unexpected(token);
170 } 171 }
171 BeginGroupToken beginGroupToken = token; 172 BeginGroupToken beginGroupToken = token;
172 Token endToken = beginGroupToken.endGroup; 173 Token endToken = beginGroupToken.endGroup;
173 listener.endFormalParameters(0, token, endToken); 174 listener.endFormalParameters(0, token, endToken);
174 return endToken.next; 175 return endToken.next;
175 } 176 }
176 } 177 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/regress_26543_1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698