| 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 "vm/exceptions.h" | 7 #include "vm/exceptions.h" |
| 8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
| 9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 dart_arguments.SetAt(5, array); | 86 dart_arguments.SetAt(5, array); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); | 89 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); |
| 90 return Object::null(); | 90 return Object::null(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) { | 94 DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) { |
| 95 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 95 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 96 // Special handling for following types outside this native. |
| 97 ASSERT(!instance.IsString() && !instance.IsInteger() && !instance.IsDouble()); |
| 96 const Type& type = Type::Handle(instance.GetType()); | 98 const Type& type = Type::Handle(instance.GetType()); |
| 97 // The static type of null is specified to be the bottom type, however, the | 99 // The static type of null is specified to be the bottom type, however, the |
| 98 // runtime type of null is the Null type, which we correctly return here. | 100 // runtime type of null is the Null type, which we correctly return here. |
| 99 return type.Canonicalize(); | 101 return type.Canonicalize(); |
| 100 } | 102 } |
| 101 | 103 |
| 102 | 104 |
| 103 DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) { | 105 DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) { |
| 104 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 106 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 105 // Instantiator at position 1 is not used. It is passed along so that the call | 107 // Instantiator at position 1 is not used. It is passed along so that the call |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 203 } |
| 202 | 204 |
| 203 | 205 |
| 204 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { | 206 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { |
| 205 const AbstractType& type = | 207 const AbstractType& type = |
| 206 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); | 208 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); |
| 207 return type.UserVisibleName(); | 209 return type.UserVisibleName(); |
| 208 } | 210 } |
| 209 | 211 |
| 210 } // namespace dart | 212 } // namespace dart |
| OLD | NEW |