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

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

Issue 8394057: Fix issue 235. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 | 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 RawType* Type::InstantiateFrom( 1638 RawType* Type::InstantiateFrom(
1639 const TypeArguments& instantiator_type_arguments, 1639 const TypeArguments& instantiator_type_arguments,
1640 intptr_t offset) const { 1640 intptr_t offset) const {
1641 // Type is an abstract class. 1641 // Type is an abstract class.
1642 UNREACHABLE(); 1642 UNREACHABLE();
1643 return Type::null(); 1643 return Type::null();
1644 } 1644 }
1645 1645
1646 1646
1647 RawString* Type::Name() const { 1647 RawString* Type::Name() const {
1648 // If the type is still being finalized, we may be reporting an error about
1649 // an illformed type, so proceed with caution.
1648 const TypeArguments& args = TypeArguments::Handle(arguments()); 1650 const TypeArguments& args = TypeArguments::Handle(arguments());
1649 const intptr_t num_args = args.IsNull() ? 0 : args.Length(); 1651 const intptr_t num_args = args.IsNull() ? 0 : args.Length();
1650 String& class_name = String::Handle(); 1652 String& class_name = String::Handle();
1651 intptr_t first_type_param_index; 1653 intptr_t first_type_param_index;
1652 intptr_t num_type_params; // Number of type parameters to print. 1654 intptr_t num_type_params; // Number of type parameters to print.
1653 if (HasResolvedTypeClass()) { 1655 if (HasResolvedTypeClass()) {
1654 const Class& cls = Class::Handle(type_class()); 1656 const Class& cls = Class::Handle(type_class());
1655 class_name = cls.Name(); 1657 class_name = cls.Name();
1656 num_type_params = cls.NumTypeParameters(); // Do not print the full vector. 1658 num_type_params = cls.NumTypeParameters(); // Do not print the full vector.
1657 if (num_type_params > num_args) { 1659 if (num_type_params > num_args) {
1658 ASSERT(num_args == 0); // Type is raw.
1659 // We fill up with "var".
1660 first_type_param_index = 0; 1660 first_type_param_index = 0;
1661 if (IsBeingFinalized()) {
1662 // Most probably an illformed type. Do not fill up with "var".
1663 num_type_params = num_args;
1664 } else {
1665 ASSERT(num_args == 0); // Type is raw.
1666 // We fill up with "var".
1667 }
1661 } else { 1668 } else {
1662 first_type_param_index = num_args - num_type_params; 1669 first_type_param_index = num_args - num_type_params;
1663 } 1670 }
1664 if (cls.IsSignatureClass()) { 1671 if (cls.IsSignatureClass()) {
1665 const Function& signature_function = Function::Handle(
1666 cls.signature_function());
1667 // We may be reporting an error about an illformed function type. In that 1672 // We may be reporting an error about an illformed function type. In that
1668 // case, avoid instantiating the signature, since it may lead to cycles. 1673 // case, avoid instantiating the signature, since it may lead to cycles.
1669 if (IsBeingFinalized()) { 1674 if (IsBeingFinalized()) {
1670 return class_name.raw(); 1675 return class_name.raw();
1671 } 1676 }
1677 const Function& signature_function = Function::Handle(
1678 cls.signature_function());
1672 return signature_function.InstantiatedSignatureFrom( 1679 return signature_function.InstantiatedSignatureFrom(
1673 args, first_type_param_index); 1680 args, first_type_param_index);
1674 } 1681 }
1675 } else { 1682 } else {
1676 const UnresolvedClass& type = UnresolvedClass::Handle(unresolved_class()); 1683 const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class());
1677 class_name = type.Name(); 1684 class_name = cls.Name();
1678 num_type_params = num_args; 1685 num_type_params = num_args;
1679 first_type_param_index = 0; 1686 first_type_param_index = 0;
1680 } 1687 }
1681 String& type_name = String::Handle(); 1688 String& type_name = String::Handle();
1682 if (num_type_params == 0) { 1689 if (num_type_params == 0) {
1683 type_name = class_name.raw(); 1690 type_name = class_name.raw();
1684 } else { 1691 } else {
1685 const intptr_t num_strings = 2*num_type_params + 2; // "C""<""T"", ""T"">". 1692 const intptr_t num_strings = 2*num_type_params + 2; // "C""<""T"", ""T"">".
1686 const Array& strings = Array::Handle(Array::New(num_strings)); 1693 const Array& strings = Array::Handle(Array::New(num_strings));
1687 intptr_t s = 0; 1694 intptr_t s = 0;
(...skipping 5103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6791 const String& str = String::Handle(pattern()); 6798 const String& str = String::Handle(pattern());
6792 const char* format = "JSRegExp: pattern=%s flags=%s"; 6799 const char* format = "JSRegExp: pattern=%s flags=%s";
6793 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 6800 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
6794 char* chars = reinterpret_cast<char*>( 6801 char* chars = reinterpret_cast<char*>(
6795 Isolate::Current()->current_zone()->Allocate(len + 1)); 6802 Isolate::Current()->current_zone()->Allocate(len + 1));
6796 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 6803 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
6797 return chars; 6804 return chars;
6798 } 6805 }
6799 6806
6800 } // namespace dart 6807 } // 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