| OLD | NEW |
| 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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 9269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9280 | 9280 |
| 9281 | 9281 |
| 9282 static void AddKeyValuePair(GrowableArray<AstNode*>* pairs, | 9282 static void AddKeyValuePair(GrowableArray<AstNode*>* pairs, |
| 9283 bool is_const, | 9283 bool is_const, |
| 9284 AstNode* key, | 9284 AstNode* key, |
| 9285 AstNode* value) { | 9285 AstNode* value) { |
| 9286 if (is_const) { | 9286 if (is_const) { |
| 9287 ASSERT(key->IsLiteralNode()); | 9287 ASSERT(key->IsLiteralNode()); |
| 9288 const Instance& new_key = key->AsLiteralNode()->literal(); | 9288 const Instance& new_key = key->AsLiteralNode()->literal(); |
| 9289 for (int i = 0; i < pairs->length(); i += 2) { | 9289 for (int i = 0; i < pairs->length(); i += 2) { |
| 9290 const Instance& key_i = | 9290 const Instance& key_i = (*pairs)[i]->AsLiteralNode()->literal(); |
| 9291 (*pairs)[i]->AsLiteralNode()->literal(); | 9291 // The keys of a compile time constant map are compile time |
| 9292 ASSERT(key_i.IsString()); | 9292 // constants, i.e. canonicalized values. Thus, we can compare |
| 9293 if (new_key.Equals(key_i)) { | 9293 // raw pointers to check for equality. |
| 9294 if (new_key.raw() == key_i.raw()) { |
| 9294 // Duplicate key found. The new value replaces the previously | 9295 // Duplicate key found. The new value replaces the previously |
| 9295 // defined value. | 9296 // defined value. |
| 9296 (*pairs)[i + 1] = value; | 9297 (*pairs)[i + 1] = value; |
| 9297 return; | 9298 return; |
| 9298 } | 9299 } |
| 9299 } | 9300 } |
| 9300 } | 9301 } |
| 9301 pairs->Add(key); | 9302 pairs->Add(key); |
| 9302 pairs->Add(value); | 9303 pairs->Add(value); |
| 9303 } | 9304 } |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10363 void Parser::SkipQualIdent() { | 10364 void Parser::SkipQualIdent() { |
| 10364 ASSERT(IsIdentifier()); | 10365 ASSERT(IsIdentifier()); |
| 10365 ConsumeToken(); | 10366 ConsumeToken(); |
| 10366 if (CurrentToken() == Token::kPERIOD) { | 10367 if (CurrentToken() == Token::kPERIOD) { |
| 10367 ConsumeToken(); // Consume the kPERIOD token. | 10368 ConsumeToken(); // Consume the kPERIOD token. |
| 10368 ExpectIdentifier("identifier expected after '.'"); | 10369 ExpectIdentifier("identifier expected after '.'"); |
| 10369 } | 10370 } |
| 10370 } | 10371 } |
| 10371 | 10372 |
| 10372 } // namespace dart | 10373 } // namespace dart |
| OLD | NEW |