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

Side by Side Diff: runtime/vm/parser.cc

Issue 11416094: Use the Equals method for C strings when comparing against C strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « 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 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 6718 matching lines...) Expand 10 before | Expand all | Expand 10 after
6729 if (!IsIdentifier()) { 6729 if (!IsIdentifier()) {
6730 ErrorMsg("%s", msg); 6730 ErrorMsg("%s", msg);
6731 } 6731 }
6732 String* ident = CurrentLiteral(); 6732 String* ident = CurrentLiteral();
6733 ConsumeToken(); 6733 ConsumeToken();
6734 return ident; 6734 return ident;
6735 } 6735 }
6736 6736
6737 6737
6738 bool Parser::IsLiteral(const char* literal) { 6738 bool Parser::IsLiteral(const char* literal) {
6739 const uint8_t* characters = reinterpret_cast<const uint8_t*>(literal); 6739 return IsIdentifier() && CurrentLiteral()->Equals(literal);
6740 intptr_t len = strlen(literal);
6741 return IsIdentifier() && CurrentLiteral()->Equals(characters, len);
6742 } 6740 }
6743 6741
6744 6742
6745 static bool IsIncrementOperator(Token::Kind token) { 6743 static bool IsIncrementOperator(Token::Kind token) {
6746 return token == Token::kINCR || token == Token::kDECR; 6744 return token == Token::kINCR || token == Token::kDECR;
6747 } 6745 }
6748 6746
6749 6747
6750 static bool IsPrefixOperator(Token::Kind token) { 6748 static bool IsPrefixOperator(Token::Kind token) {
6751 return (token == Token::kTIGHTADD) || // Valid for literals only! 6749 return (token == Token::kTIGHTADD) || // Valid for literals only!
(...skipping 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after
10031 void Parser::SkipQualIdent() { 10029 void Parser::SkipQualIdent() {
10032 ASSERT(IsIdentifier()); 10030 ASSERT(IsIdentifier());
10033 ConsumeToken(); 10031 ConsumeToken();
10034 if (CurrentToken() == Token::kPERIOD) { 10032 if (CurrentToken() == Token::kPERIOD) {
10035 ConsumeToken(); // Consume the kPERIOD token. 10033 ConsumeToken(); // Consume the kPERIOD token.
10036 ExpectIdentifier("identifier expected after '.'"); 10034 ExpectIdentifier("identifier expected after '.'");
10037 } 10035 }
10038 } 10036 }
10039 10037
10040 } // namespace dart 10038 } // namespace dart
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