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

Unified Diff: pkg/compiler/lib/src/parser/parser.dart

Issue 1503063002: Handle const loop variable. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/parser/parser.dart
diff --git a/pkg/compiler/lib/src/parser/parser.dart b/pkg/compiler/lib/src/parser/parser.dart
index 7adddb5f2cff272bf02554d1515d2f9287f52119..20c00a7d80ca9a79af0d57c3e58b8a96efda1eb7 100644
--- a/pkg/compiler/lib/src/parser/parser.dart
+++ b/pkg/compiler/lib/src/parser/parser.dart
@@ -660,15 +660,27 @@ class Parser {
/**
* Returns true if the stringValue of the [token] is either [value1],
+ * [value2], or [value3].
+ */
+ bool isOneOf3(Token token,
+ String value1, String value2, String value3) {
karlklose 2015/12/08 09:23:30 Indentation.
Johnni Winther 2015/12/08 10:07:17 Done.
+ String stringValue = token.stringValue;
+ return value1 == stringValue ||
+ value2 == stringValue ||
karlklose 2015/12/08 09:23:30 Indentation.
Johnni Winther 2015/12/08 10:07:17 Done.
+ value3 == stringValue;
+ }
+
+ /**
+ * Returns true if the stringValue of the [token] is either [value1],
* [value2], [value3], or [value4].
*/
bool isOneOf4(Token token,
String value1, String value2, String value3, String value4) {
String stringValue = token.stringValue;
- return identical(value1, stringValue) ||
- identical(value2, stringValue) ||
- identical(value3, stringValue) ||
- identical(value4, stringValue);
+ return value1 == stringValue ||
+ value2 == stringValue ||
+ value3 == stringValue ||
+ value4 == stringValue;
}
bool notEofOrValue(String value, Token token) {
@@ -2427,7 +2439,7 @@ class Parser {
if (identical(value, ';')) {
listener.handleNoExpression(token);
return token;
- } else if ((identical(value, 'var')) || (identical(value, 'final'))) {
+ } else if (isOneOf3(token, 'var', 'final', 'const')) {
return parseVariablesDeclarationNoSemicolon(token);
}
Token identifier = peekIdentifierAfterType(token);
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698