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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2801963003: Use identical to compare strings. (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 fasta.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../fasta_codes.dart' 7 import '../fasta_codes.dart'
8 show 8 show
9 FastaCode, 9 FastaCode,
10 FastaMessage, 10 FastaMessage,
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 listener.handleNoType(token); 1018 listener.handleNoType(token);
1019 } 1019 }
1020 listener.endTypeVariable(token, extendsOrSuper); 1020 listener.endTypeVariable(token, extendsOrSuper);
1021 return token; 1021 return token;
1022 } 1022 }
1023 1023
1024 /// Returns true if the stringValue of the [token] is either [value1], 1024 /// Returns true if the stringValue of the [token] is either [value1],
1025 /// [value2], or [value3]. 1025 /// [value2], or [value3].
1026 bool isOneOf3(Token token, String value1, String value2, String value3) { 1026 bool isOneOf3(Token token, String value1, String value2, String value3) {
1027 String stringValue = token.stringValue; 1027 String stringValue = token.stringValue;
1028 return value1 == stringValue || 1028 return identical(value1, stringValue) ||
1029 value2 == stringValue || 1029 identical(value2, stringValue) ||
1030 value3 == stringValue; 1030 identical(value3, stringValue);
1031 } 1031 }
1032 1032
1033 /// Returns true if the stringValue of the [token] is either [value1], 1033 /// Returns true if the stringValue of the [token] is either [value1],
1034 /// [value2], [value3], or [value4]. 1034 /// [value2], [value3], or [value4].
1035 bool isOneOf4( 1035 bool isOneOf4(
1036 Token token, String value1, String value2, String value3, String value4) { 1036 Token token, String value1, String value2, String value3, String value4) {
1037 String stringValue = token.stringValue; 1037 String stringValue = token.stringValue;
1038 return value1 == stringValue || 1038 return identical(value1, stringValue) ||
1039 value2 == stringValue || 1039 identical(value2, stringValue) ||
1040 value3 == stringValue || 1040 identical(value3, stringValue) ||
1041 value4 == stringValue; 1041 identical(value4, stringValue);
1042 } 1042 }
1043 1043
1044 bool notEofOrValue(String value, Token token) { 1044 bool notEofOrValue(String value, Token token) {
1045 return !identical(token.kind, EOF_TOKEN) && 1045 return !identical(token.kind, EOF_TOKEN) &&
1046 !identical(value, token.stringValue); 1046 !identical(value, token.stringValue);
1047 } 1047 }
1048 1048
1049 bool isGeneralizedFunctionType(Token token) { 1049 bool isGeneralizedFunctionType(Token token) {
1050 return optional('Function', token) && 1050 return optional('Function', token) &&
1051 (optional('<', token.next) || optional('(', token.next)); 1051 (optional('<', token.next) || optional('(', token.next));
(...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 previous.setNext(firstToken); 3855 previous.setNext(firstToken);
3856 beforeToken = firstToken; 3856 beforeToken = firstToken;
3857 } 3857 }
3858 } 3858 }
3859 3859
3860 typedef FastaMessage NoArgument(Uri uri, int charOffset); 3860 typedef FastaMessage NoArgument(Uri uri, int charOffset);
3861 3861
3862 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); 3862 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token);
3863 3863
3864 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); 3864 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698