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/become.h" | 10 #include "vm/become.h" |
(...skipping 16660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16671 const char* AbstractType::ToCString() const { | 16671 const char* AbstractType::ToCString() const { |
16672 if (IsNull()) { | 16672 if (IsNull()) { |
16673 return "AbstractType: null"; | 16673 return "AbstractType: null"; |
16674 } | 16674 } |
16675 // AbstractType is an abstract class. | 16675 // AbstractType is an abstract class. |
16676 UNREACHABLE(); | 16676 UNREACHABLE(); |
16677 return "AbstractType"; | 16677 return "AbstractType"; |
16678 } | 16678 } |
16679 | 16679 |
16680 | 16680 |
| 16681 bool simpleInstanceOfType(const AbstractType& type) { |
| 16682 // Bail if the type is still uninstantiated at compile time. |
| 16683 if (!type.IsInstantiated()) return false; |
| 16684 |
| 16685 // Bail if the type is a function or a Dart Function type. |
| 16686 if (type.IsFunctionType() || type.IsDartFunctionType()) return false; |
| 16687 |
| 16688 ASSERT(type.HasResolvedTypeClass()); |
| 16689 const Class& type_class = Class::Handle(type.type_class()); |
| 16690 // Bail if the type has any type parameters. |
| 16691 if (type_class.IsGeneric()) return false; |
| 16692 |
| 16693 // Finally a simple class for instance of checking. |
| 16694 return true; |
| 16695 } |
| 16696 |
| 16697 |
16681 RawType* Type::NullType() { | 16698 RawType* Type::NullType() { |
16682 return Isolate::Current()->object_store()->null_type(); | 16699 return Isolate::Current()->object_store()->null_type(); |
16683 } | 16700 } |
16684 | 16701 |
16685 | 16702 |
16686 RawType* Type::DynamicType() { | 16703 RawType* Type::DynamicType() { |
16687 return Object::dynamic_type().raw(); | 16704 return Object::dynamic_type().raw(); |
16688 } | 16705 } |
16689 | 16706 |
16690 | 16707 |
(...skipping 6440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23131 return UserTag::null(); | 23148 return UserTag::null(); |
23132 } | 23149 } |
23133 | 23150 |
23134 | 23151 |
23135 const char* UserTag::ToCString() const { | 23152 const char* UserTag::ToCString() const { |
23136 const String& tag_label = String::Handle(label()); | 23153 const String& tag_label = String::Handle(label()); |
23137 return tag_label.ToCString(); | 23154 return tag_label.ToCString(); |
23138 } | 23155 } |
23139 | 23156 |
23140 } // namespace dart | 23157 } // namespace dart |
OLD | NEW |