| OLD | NEW |
| 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 } | 871 } |
| 872 return sup_type.type_class(); | 872 return sup_type.type_class(); |
| 873 } | 873 } |
| 874 | 874 |
| 875 | 875 |
| 876 void Class::set_super_type(const Type& value) const { | 876 void Class::set_super_type(const Type& value) const { |
| 877 StorePointer(&raw_ptr()->super_type_, value.raw()); | 877 StorePointer(&raw_ptr()->super_type_, value.raw()); |
| 878 } | 878 } |
| 879 | 879 |
| 880 | 880 |
| 881 bool Class::HasFactoryClass() const { |
| 882 const Object& factory_class = Object::Handle(raw_ptr()->factory_class_); |
| 883 return !factory_class.IsNull(); |
| 884 } |
| 885 |
| 886 |
| 887 bool Class::HasResolvedFactoryClass() const { |
| 888 ASSERT(HasFactoryClass()); |
| 889 const Object& factory_class = Object::Handle(raw_ptr()->factory_class_); |
| 890 return factory_class.IsClass(); |
| 891 } |
| 892 |
| 893 |
| 881 RawClass* Class::FactoryClass() const { | 894 RawClass* Class::FactoryClass() const { |
| 882 const Type& fact_type = Type::Handle(factory_type()); | 895 ASSERT(HasResolvedFactoryClass()); |
| 883 if (fact_type.IsNull()) { | 896 Class& type_class = Class::Handle(); |
| 884 return Class::null(); | 897 type_class ^= raw_ptr()->factory_class_; |
| 885 } | 898 return type_class.raw(); |
| 886 return fact_type.type_class(); | |
| 887 } | 899 } |
| 888 | 900 |
| 889 | 901 |
| 890 void Class::set_factory_type(const Type& value) const { | 902 RawUnresolvedClass* Class::UnresolvedFactoryClass() const { |
| 891 StorePointer(&raw_ptr()->factory_type_, value.raw()); | 903 ASSERT(!HasResolvedFactoryClass()); |
| 904 UnresolvedClass& unresolved_factory_class = UnresolvedClass::Handle(); |
| 905 unresolved_factory_class ^= raw_ptr()->factory_class_; |
| 906 return unresolved_factory_class.raw(); |
| 907 } |
| 908 |
| 909 |
| 910 void Class::set_factory_class(const Object& value) const { |
| 911 StorePointer(&raw_ptr()->factory_class_, value.raw()); |
| 892 } | 912 } |
| 893 | 913 |
| 894 | 914 |
| 895 // Return a TypeParameter if the type_name is a type parameter of this class. | 915 // Return a TypeParameter if the type_name is a type parameter of this class. |
| 896 // Return null otherwise. | 916 // Return null otherwise. |
| 897 RawTypeParameter* Class::LookupTypeParameter(const String& type_name) const { | 917 RawTypeParameter* Class::LookupTypeParameter(const String& type_name) const { |
| 898 ASSERT(!type_name.IsNull()); | 918 ASSERT(!type_name.IsNull()); |
| 899 const Array& type_params = Array::Handle(type_parameters()); | 919 const Array& type_params = Array::Handle(type_parameters()); |
| 900 if (!type_params.IsNull()) { | 920 if (!type_params.IsNull()) { |
| 901 intptr_t num_type_params = type_params.Length(); | 921 intptr_t num_type_params = type_params.Length(); |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 void UnresolvedClass::set_ident(const String& ident) const { | 1595 void UnresolvedClass::set_ident(const String& ident) const { |
| 1576 StorePointer(&raw_ptr()->ident_, ident.raw()); | 1596 StorePointer(&raw_ptr()->ident_, ident.raw()); |
| 1577 } | 1597 } |
| 1578 | 1598 |
| 1579 | 1599 |
| 1580 void UnresolvedClass::set_qualifier(const String& qualifier) const { | 1600 void UnresolvedClass::set_qualifier(const String& qualifier) const { |
| 1581 StorePointer(&raw_ptr()->qualifier_, qualifier.raw()); | 1601 StorePointer(&raw_ptr()->qualifier_, qualifier.raw()); |
| 1582 } | 1602 } |
| 1583 | 1603 |
| 1584 | 1604 |
| 1605 void UnresolvedClass::set_factory_signature_class(const Class& value) const { |
| 1606 StorePointer(&raw_ptr()->factory_signature_class_, value.raw()); |
| 1607 } |
| 1608 |
| 1609 |
| 1585 RawString* UnresolvedClass::Name() const { | 1610 RawString* UnresolvedClass::Name() const { |
| 1586 if (qualifier() != String::null()) { | 1611 if (qualifier() != String::null()) { |
| 1587 String& name = String::Handle(); | 1612 String& name = String::Handle(); |
| 1588 name = qualifier(); | 1613 name = qualifier(); |
| 1589 String& str = String::Handle(); | 1614 String& str = String::Handle(); |
| 1590 str = String::New("."); | 1615 str = String::New("."); |
| 1591 name = String::Concat(name, str); | 1616 name = String::Concat(name, str); |
| 1592 str = ident(); | 1617 str = ident(); |
| 1593 name = String::Concat(name, str); | 1618 name = String::Concat(name, str); |
| 1594 return name.raw(); | 1619 return name.raw(); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1958 } | 1983 } |
| 1959 | 1984 |
| 1960 | 1985 |
| 1961 void ParameterizedType::set_is_being_finalized() const { | 1986 void ParameterizedType::set_is_being_finalized() const { |
| 1962 ASSERT(!IsFinalized() && !IsBeingFinalized()); | 1987 ASSERT(!IsFinalized() && !IsBeingFinalized()); |
| 1963 set_type_state(RawParameterizedType::kBeingFinalized); | 1988 set_type_state(RawParameterizedType::kBeingFinalized); |
| 1964 } | 1989 } |
| 1965 | 1990 |
| 1966 | 1991 |
| 1967 bool ParameterizedType::IsResolved() const { | 1992 bool ParameterizedType::IsResolved() const { |
| 1993 if (IsFinalized()) { |
| 1994 return true; |
| 1995 } |
| 1968 if (!HasResolvedTypeClass()) { | 1996 if (!HasResolvedTypeClass()) { |
| 1969 return false; | 1997 return false; |
| 1970 } | 1998 } |
| 1971 const TypeArguments& args = TypeArguments::Handle(arguments()); | 1999 const TypeArguments& args = TypeArguments::Handle(arguments()); |
| 1972 return args.IsNull() || args.IsResolved(); | 2000 return args.IsNull() || args.IsResolved(); |
| 1973 } | 2001 } |
| 1974 | 2002 |
| 1975 | 2003 |
| 1976 bool ParameterizedType::HasResolvedTypeClass() const { | 2004 bool ParameterizedType::HasResolvedTypeClass() const { |
| 1977 const Object& type_class = Object::Handle(raw_ptr()->type_class_); | 2005 const Object& type_class = Object::Handle(raw_ptr()->type_class_); |
| (...skipping 5022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7000 const String& str = String::Handle(pattern()); | 7028 const String& str = String::Handle(pattern()); |
| 7001 const char* format = "JSRegExp: pattern=%s flags=%s"; | 7029 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 7002 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 7030 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 7003 char* chars = reinterpret_cast<char*>( | 7031 char* chars = reinterpret_cast<char*>( |
| 7004 Isolate::Current()->current_zone()->Allocate(len + 1)); | 7032 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 7005 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 7033 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 7006 return chars; | 7034 return chars; |
| 7007 } | 7035 } |
| 7008 | 7036 |
| 7009 } // namespace dart | 7037 } // namespace dart |
| OLD | NEW |