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

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

Issue 8677019: Fix build breakage. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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/language/language.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 6622 matching lines...) Expand 10 before | Expand all | Expand 10 after
6633 if (is_const) { 6633 if (is_const) {
6634 // Allocate and initialize the const list at compile time. 6634 // Allocate and initialize the const list at compile time.
6635 Array& const_list = 6635 Array& const_list =
6636 Array::ZoneHandle(Array::New(list->length(), Heap::kOld)); 6636 Array::ZoneHandle(Array::New(list->length(), Heap::kOld));
6637 const_list.SetTypeArguments(type_arguments); 6637 const_list.SetTypeArguments(type_arguments);
6638 6638
6639 for (int i = 0; i < list->length(); i++) { 6639 for (int i = 0; i < list->length(); i++) {
6640 AstNode* elem = list->ElementAt(i); 6640 AstNode* elem = list->ElementAt(i);
6641 // Arguments have been evaluated to a literal value already. 6641 // Arguments have been evaluated to a literal value already.
6642 ASSERT(elem->IsLiteralNode()); 6642 ASSERT(elem->IsLiteralNode());
6643 if (!element_type.IsDynamicType() && 6643 if (FLAG_enable_type_checks &&
6644 !elem->AsLiteralNode()->literal().Is(element_type)) { 6644 !element_type.IsDynamicType() &&
6645 !elem->AsLiteralNode()->literal().
6646 IsAssignableTo(element_type, TypeArguments::Handle())) {
6645 ErrorMsg(elem->AsLiteralNode()->token_index(), 6647 ErrorMsg(elem->AsLiteralNode()->token_index(),
6646 "list literal element at index %d must be " 6648 "list literal element at index %d must be "
6647 "a constant of type '%s'", 6649 "a constant of type '%s'",
6648 i, 6650 i,
6649 String::Handle(element_type.Name()).ToCString()); 6651 String::Handle(element_type.Name()).ToCString());
6650 } 6652 }
6651 const_list.SetAt(i, elem->AsLiteralNode()->literal()); 6653 const_list.SetAt(i, elem->AsLiteralNode()->literal());
6652 } 6654 }
6653 const_list ^= const_list.Canonicalize(); 6655 const_list ^= const_list.Canonicalize();
6654 const_list.MakeImmutable(); 6656 const_list.MakeImmutable();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
6791 // the immutable map object with it. This all happens at compile time. 6793 // the immutable map object with it. This all happens at compile time.
6792 // The resulting immutable map object is returned as a literal. 6794 // The resulting immutable map object is returned as a literal.
6793 6795
6794 // First, create the canonicalized key-value pair array. 6796 // First, create the canonicalized key-value pair array.
6795 Array& key_value_array = 6797 Array& key_value_array =
6796 Array::ZoneHandle(Array::New(kv_pairs->length(), Heap::kOld)); 6798 Array::ZoneHandle(Array::New(kv_pairs->length(), Heap::kOld));
6797 for (int i = 0; i < kv_pairs->length(); i++) { 6799 for (int i = 0; i < kv_pairs->length(); i++) {
6798 AstNode* arg = kv_pairs->ElementAt(i); 6800 AstNode* arg = kv_pairs->ElementAt(i);
6799 // Arguments have been evaluated to a literal value already. 6801 // Arguments have been evaluated to a literal value already.
6800 ASSERT(arg->IsLiteralNode()); 6802 ASSERT(arg->IsLiteralNode());
6801 if (((i % 2) == 1) && // Check values only, not keys. 6803 if (FLAG_enable_type_checks &&
6804 ((i % 2) == 1) && // Check values only, not keys.
6802 !value_type.IsDynamicType() && 6805 !value_type.IsDynamicType() &&
6803 !arg->AsLiteralNode()->literal().Is(value_type)) { 6806 !arg->AsLiteralNode()->literal().
6807 IsAssignableTo(value_type, TypeArguments::Handle())) {
6804 ErrorMsg(arg->AsLiteralNode()->token_index(), 6808 ErrorMsg(arg->AsLiteralNode()->token_index(),
6805 "map literal value at index %d must be " 6809 "map literal value at index %d must be "
6806 "a constant of type '%s'", 6810 "a constant of type '%s'",
6807 i >> 1, 6811 i >> 1,
6808 String::Handle(value_type.Name()).ToCString()); 6812 String::Handle(value_type.Name()).ToCString());
6809 } 6813 }
6810 key_value_array.SetAt(i, arg->AsLiteralNode()->literal()); 6814 key_value_array.SetAt(i, arg->AsLiteralNode()->literal());
6811 } 6815 }
6812 key_value_array ^= key_value_array.Canonicalize(); 6816 key_value_array ^= key_value_array.Canonicalize();
6813 key_value_array.MakeImmutable(); 6817 key_value_array.MakeImmutable();
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
7530 } 7534 }
7531 7535
7532 7536
7533 void Parser::SkipNestedExpr() { 7537 void Parser::SkipNestedExpr() {
7534 const bool saved_mode = SetAllowFunctionLiterals(true); 7538 const bool saved_mode = SetAllowFunctionLiterals(true);
7535 SkipExpr(); 7539 SkipExpr();
7536 SetAllowFunctionLiterals(saved_mode); 7540 SetAllowFunctionLiterals(saved_mode);
7537 } 7541 }
7538 7542
7539 } // namespace dart 7543 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698