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

Side by Side Diff: runtime/vm/token.h

Issue 12852007: Improve code for !identical(a, b): (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | tests/language/identical_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) 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 #ifndef VM_TOKEN_H_ 5 #ifndef VM_TOKEN_H_
6 #define VM_TOKEN_H_ 6 #define VM_TOKEN_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return ((tok == Token::kINTEGER) || 283 return ((tok == Token::kINTEGER) ||
284 (tok == Token::kSTRING) || 284 (tok == Token::kSTRING) ||
285 (tok == Token::kINTERPOL_VAR) || 285 (tok == Token::kINTERPOL_VAR) ||
286 (tok == Token::kERROR) || 286 (tok == Token::kERROR) ||
287 (tok == Token::kDOUBLE)); 287 (tok == Token::kDOUBLE));
288 } 288 }
289 289
290 static bool IsBinaryOperator(Token::Kind token); 290 static bool IsBinaryOperator(Token::Kind token);
291 static bool IsPrefixOperator(Token::Kind token); 291 static bool IsPrefixOperator(Token::Kind token);
292 292
293 // For a comparison operation return an operation for the negated comparison:
294 // !(a (op) b) === a (op') b
295 static Token::Kind NegateComparison(Token::Kind op) {
296 switch (op) {
297 case Token::kEQ: return Token::kNE;
298 case Token::kNE: return Token::kEQ;
299 case Token::kLT: return Token::kGTE;
300 case Token::kGT: return Token::kLTE;
301 case Token::kLTE: return Token::kGT;
302 case Token::kGTE: return Token::kLT;
303 case Token::kEQ_STRICT: return Token::kNE_STRICT;
304 case Token::kNE_STRICT: return Token::kEQ_STRICT;
305 default:
306 UNREACHABLE();
307 return Token::kILLEGAL;
308 }
309 }
310
293 private: 311 private:
294 static const char* name_[]; 312 static const char* name_[];
295 static const char* tok_str_[]; 313 static const char* tok_str_[];
296 static const uint8_t precedence_[]; 314 static const uint8_t precedence_[];
297 static const Attribute attributes_[]; 315 static const Attribute attributes_[];
298 }; 316 };
299 317
300 318
301 } // namespace dart 319 } // namespace dart
302 320
303 #endif // VM_TOKEN_H_ 321 #endif // VM_TOKEN_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | tests/language/identical_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698