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

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, 9 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
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return ((tok == Token::kINTEGER) || 286 return ((tok == Token::kINTEGER) ||
287 (tok == Token::kSTRING) || 287 (tok == Token::kSTRING) ||
288 (tok == Token::kINTERPOL_VAR) || 288 (tok == Token::kINTERPOL_VAR) ||
289 (tok == Token::kERROR) || 289 (tok == Token::kERROR) ||
290 (tok == Token::kDOUBLE)); 290 (tok == Token::kDOUBLE));
291 } 291 }
292 292
293 static bool IsBinaryOperator(Token::Kind token); 293 static bool IsBinaryOperator(Token::Kind token);
294 static bool IsPrefixOperator(Token::Kind token); 294 static bool IsPrefixOperator(Token::Kind token);
295 295
296 // For a comparison operation return an operation for the negated comparison:
297 // !(a (op) b) === a (op') b
298 static Token::Kind NegateComparison(Token::Kind op) {
299 switch (op) {
300 case Token::kEQ: return Token::kNE;
301 case Token::kNE: return Token::kEQ;
302 case Token::kLT: return Token::kGTE;
303 case Token::kGT: return Token::kLTE;
304 case Token::kLTE: return Token::kGT;
305 case Token::kGTE: return Token::kLT;
306 case Token::kEQ_STRICT: return Token::kNE_STRICT;
307 case Token::kNE_STRICT: return Token::kEQ_STRICT;
308 default:
309 UNREACHABLE();
310 return Token::kILLEGAL;
311 }
312 }
313
296 private: 314 private:
297 static const char* name_[]; 315 static const char* name_[];
298 static const char* tok_str_[]; 316 static const char* tok_str_[];
299 static const uint8_t precedence_[]; 317 static const uint8_t precedence_[];
300 static const Attribute attributes_[]; 318 static const Attribute attributes_[];
301 }; 319 };
302 320
303 321
304 } // namespace dart 322 } // namespace dart
305 323
306 #endif // VM_TOKEN_H_ 324 #endif // VM_TOKEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698