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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 13820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13831 if (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) { | 13831 if (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) { |
13832 return true; | 13832 return true; |
13833 } | 13833 } |
13834 if (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated) { | 13834 if (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated) { |
13835 return false; | 13835 return false; |
13836 } | 13836 } |
13837 if (arguments() == TypeArguments::null()) { | 13837 if (arguments() == TypeArguments::null()) { |
13838 return true; | 13838 return true; |
13839 } | 13839 } |
13840 const TypeArguments& args = TypeArguments::Handle(arguments()); | 13840 const TypeArguments& args = TypeArguments::Handle(arguments()); |
13841 const intptr_t num_type_args = args.Length(); | 13841 intptr_t num_type_args = args.Length(); |
13842 intptr_t len = num_type_args; // Check the full vector of type args. | 13842 intptr_t len = num_type_args; // Check the full vector of type args. |
13843 ASSERT(num_type_args > 0); | 13843 ASSERT(num_type_args > 0); |
13844 // This type is not instantiated if it refers to type parameters. | 13844 // This type is not instantiated if it refers to type parameters. |
13845 // This IsInstantiated() call may be invoked on an unresolved signature type. | 13845 // This IsInstantiated() call may be invoked on an unresolved signature type. |
13846 // Although this type may still be unresolved, the type parameters it may | 13846 // Although this type may still be unresolved, the type parameters it may |
13847 // refer to are resolved by definition. We can therefore return the correct | 13847 // refer to are resolved by definition. We can therefore return the correct |
13848 // result even for an unresolved type. We just need to look at all type | 13848 // result even for an unresolved type. We just need to look at all type |
13849 // arguments and not just at the type parameters. | 13849 // arguments and not just at the type parameters. |
13850 if (HasResolvedTypeClass()) { | 13850 if (HasResolvedTypeClass()) { |
13851 const Class& cls = Class::Handle(type_class()); | 13851 const Class& cls = Class::Handle(type_class()); |
| 13852 len = cls.NumTypeArguments(); |
| 13853 ASSERT(num_type_args >= len); // The vector may be longer than necessary. |
| 13854 num_type_args = len; |
13852 len = cls.NumTypeParameters(); // Check the type parameters only. | 13855 len = cls.NumTypeParameters(); // Check the type parameters only. |
13853 ASSERT(num_type_args == cls.NumTypeArguments()); | |
13854 } | 13856 } |
13855 return (len == 0) || args.IsSubvectorInstantiated(num_type_args - len, len); | 13857 return (len == 0) || args.IsSubvectorInstantiated(num_type_args - len, len); |
13856 } | 13858 } |
13857 | 13859 |
13858 | 13860 |
13859 RawAbstractType* Type::InstantiateFrom( | 13861 RawAbstractType* Type::InstantiateFrom( |
13860 const TypeArguments& instantiator_type_arguments, | 13862 const TypeArguments& instantiator_type_arguments, |
13861 Error* bound_error, | 13863 Error* bound_error, |
13862 GrowableObjectArray* trail) const { | 13864 GrowableObjectArray* trail) const { |
13863 ASSERT(IsFinalized() || IsBeingFinalized()); | 13865 ASSERT(IsFinalized() || IsBeingFinalized()); |
(...skipping 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18854 return tag_label.ToCString(); | 18856 return tag_label.ToCString(); |
18855 } | 18857 } |
18856 | 18858 |
18857 | 18859 |
18858 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18860 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
18859 Instance::PrintJSONImpl(stream, ref); | 18861 Instance::PrintJSONImpl(stream, ref); |
18860 } | 18862 } |
18861 | 18863 |
18862 | 18864 |
18863 } // namespace dart | 18865 } // namespace dart |
OLD | NEW |