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

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

Issue 23004015: Remove assertion in compile-time constant map literals (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « no previous file | tests/co19/co19-runtime.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 #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
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
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
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698