| 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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 const Bool& negate = Bool::CheckedHandle(arguments->NativeArgAt(4)); | 121 const Bool& negate = Bool::CheckedHandle(arguments->NativeArgAt(4)); |
| 122 ASSERT(type.IsFinalized()); | 122 ASSERT(type.IsFinalized()); |
| 123 ASSERT(!type.IsMalformed()); | 123 ASSERT(!type.IsMalformed()); |
| 124 ASSERT(!type.IsMalbounded()); | 124 ASSERT(!type.IsMalbounded()); |
| 125 Error& bound_error = Error::Handle(); | 125 Error& bound_error = Error::Handle(); |
| 126 const bool is_instance_of = instance.IsInstanceOf(type, | 126 const bool is_instance_of = instance.IsInstanceOf(type, |
| 127 instantiator_type_arguments, | 127 instantiator_type_arguments, |
| 128 &bound_error); | 128 &bound_error); |
| 129 if (FLAG_trace_type_checks) { | 129 if (FLAG_trace_type_checks) { |
| 130 const char* result_str = is_instance_of ? "true" : "false"; | 130 const char* result_str = is_instance_of ? "true" : "false"; |
| 131 OS::Print("Object.instanceOf: result %s\n", result_str); | 131 OS::Print("Native Object.instanceOf: result %s\n", result_str); |
| 132 const Type& instance_type = Type::Handle(instance.GetType()); | 132 const Type& instance_type = Type::Handle(instance.GetType()); |
| 133 OS::Print(" instance type: %s\n", | 133 OS::Print(" instance type: %s\n", |
| 134 String::Handle(instance_type.Name()).ToCString()); | 134 String::Handle(instance_type.Name()).ToCString()); |
| 135 OS::Print(" test type: %s\n", String::Handle(type.Name()).ToCString()); | 135 OS::Print(" test type: %s\n", String::Handle(type.Name()).ToCString()); |
| 136 if (!bound_error.IsNull()) { | 136 if (!bound_error.IsNull()) { |
| 137 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); | 137 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 if (!is_instance_of && !bound_error.IsNull()) { | 140 if (!is_instance_of && !bound_error.IsNull()) { |
| 141 // Throw a dynamic type error only if the instanceof test fails. | 141 // Throw a dynamic type error only if the instanceof test fails. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 | 226 |
| 227 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { | 227 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { |
| 228 const AbstractType& type = | 228 const AbstractType& type = |
| 229 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); | 229 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); |
| 230 return type.UserVisibleName(); | 230 return type.UserVisibleName(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace dart | 233 } // namespace dart |
| OLD | NEW |