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

Unified Diff: runtime/vm/scanner.cc

Issue 10456060: Eliminate unary plus with hex literals (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scanner.cc
===================================================================
--- runtime/vm/scanner.cc (revision 8171)
+++ runtime/vm/scanner.cc (working copy)
@@ -631,7 +631,12 @@
ReadChar();
current_token_.kind =
IsNumberStart(c0_) ? Token::kTIGHTADD : Token::kADD;
- if (c0_ == '+') {
+ // Unary + is not allowed for hexadecimal integers, so treat the
+ // + as a binary operator.
+ if ((c0_ == '0') &&
+ ((LookaheadChar(1) == 'x') || (LookaheadChar(1) == 'X'))) {
+ current_token_.kind = Token::kADD;
+ } else if (c0_ == '+') {
Recognize(Token::kINCR);
} else if (c0_ == '=') {
Recognize(Token::kASSIGN_ADD);
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698