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

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

Issue 10911206: Remove support for operator negate and replace occurrences with unary (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/parser.cc ('k') | tests/co19/co19-dart2js.status » ('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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 static int Precedence(Kind tok) { 261 static int Precedence(Kind tok) {
262 ASSERT(tok < kNumTokens); 262 ASSERT(tok < kNumTokens);
263 return precedence_[tok]; 263 return precedence_[tok];
264 } 264 }
265 265
266 static Attribute Attributes(Kind tok) { 266 static Attribute Attributes(Kind tok) {
267 ASSERT(tok < kNumTokens); 267 ASSERT(tok < kNumTokens);
268 return attributes_[tok]; 268 return attributes_[tok];
269 } 269 }
270 270
271 // TODO(hausner): Remove the pseudo keyword 'negate' when old operator
272 // syntax for unary - is removed.
273 static bool CanBeOverloaded(Kind tok) { 271 static bool CanBeOverloaded(Kind tok) {
274 ASSERT(tok < kNumTokens); 272 ASSERT(tok < kNumTokens);
275 return IsRelationalOperator(tok) || 273 return IsRelationalOperator(tok) ||
276 (tok == kEQ) || 274 (tok == kEQ) ||
277 (tok >= kADD && tok <= kMOD) || // Arithmetic operations. 275 (tok >= kADD && tok <= kMOD) || // Arithmetic operations.
278 (tok >= kBIT_OR && tok <= kSHR) || // Bit operations. 276 (tok >= kBIT_OR && tok <= kSHR) || // Bit operations.
279 (tok == kINDEX) || 277 (tok == kINDEX) ||
280 (tok == kASSIGN_INDEX) || 278 (tok == kASSIGN_INDEX);
281 (tok == kNEGATE);
282 } 279 }
283 280
284 static bool NeedsLiteralToken(Kind tok) { 281 static bool NeedsLiteralToken(Kind tok) {
285 ASSERT(tok < kNumTokens); 282 ASSERT(tok < kNumTokens);
286 return ((tok == Token::kINTEGER) || 283 return ((tok == Token::kINTEGER) ||
287 (tok == Token::kSTRING) || 284 (tok == Token::kSTRING) ||
288 (tok == Token::kINTERPOL_VAR) || 285 (tok == Token::kINTERPOL_VAR) ||
289 (tok == Token::kERROR) || 286 (tok == Token::kERROR) ||
290 (tok == Token::kDOUBLE)); 287 (tok == Token::kDOUBLE));
291 } 288 }
292 289
293 static bool IsBinaryToken(Token::Kind token); 290 static bool IsBinaryToken(Token::Kind token);
294 static bool IsUnaryToken(Token::Kind token); 291 static bool IsUnaryToken(Token::Kind token);
295 292
296 private: 293 private:
297 static const char* name_[]; 294 static const char* name_[];
298 static const char* tok_str_[]; 295 static const char* tok_str_[];
299 static const uint8_t precedence_[]; 296 static const uint8_t precedence_[];
300 static const Attribute attributes_[]; 297 static const Attribute attributes_[];
301 }; 298 };
302 299
303 300
304 } // namespace dart 301 } // namespace dart
305 302
306 #endif // VM_TOKEN_H_ 303 #endif // VM_TOKEN_H_
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698