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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 #include "vm/exceptions.h" | 6 #include "vm/exceptions.h" |
7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
8 #include "vm/runtime_entry.h" | 8 #include "vm/runtime_entry.h" |
9 #include "vm/stack_frame.h" | 9 #include "vm/stack_frame.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // No need to type check the arguments. This function can only be called | 110 // No need to type check the arguments. This function can only be called |
111 // internally from the VM. | 111 // internally from the VM. |
112 const TokenPosition location = | 112 const TokenPosition location = |
113 TokenPosition(Smi::CheckedHandle(arguments->NativeArgAt(0)).Value()); | 113 TokenPosition(Smi::CheckedHandle(arguments->NativeArgAt(0)).Value()); |
114 const Instance& src_value = | 114 const Instance& src_value = |
115 Instance::CheckedHandle(arguments->NativeArgAt(1)); | 115 Instance::CheckedHandle(arguments->NativeArgAt(1)); |
116 const AbstractType& dst_type = | 116 const AbstractType& dst_type = |
117 AbstractType::CheckedHandle(arguments->NativeArgAt(2)); | 117 AbstractType::CheckedHandle(arguments->NativeArgAt(2)); |
118 const String& dst_name = String::CheckedHandle(arguments->NativeArgAt(3)); | 118 const String& dst_name = String::CheckedHandle(arguments->NativeArgAt(3)); |
119 const String& error_msg = String::CheckedHandle(arguments->NativeArgAt(4)); | 119 const String& error_msg = String::CheckedHandle(arguments->NativeArgAt(4)); |
120 const AbstractType& src_type = AbstractType::Handle(src_value.GetType()); | 120 const AbstractType& src_type = |
| 121 AbstractType::Handle(src_value.GetType(Heap::kNew)); |
121 Exceptions::CreateAndThrowTypeError(location, src_type, dst_type, dst_name, | 122 Exceptions::CreateAndThrowTypeError(location, src_type, dst_type, dst_name, |
122 error_msg); | 123 error_msg); |
123 UNREACHABLE(); | 124 UNREACHABLE(); |
124 return Object::null(); | 125 return Object::null(); |
125 } | 126 } |
126 | 127 |
127 | 128 |
128 // Allocate and throw a new FallThroughError. | 129 // Allocate and throw a new FallThroughError. |
129 // Arg0: index of the case clause token into which we fall through. | 130 // Arg0: index of the case clause token into which we fall through. |
130 // Return value: none, throws an exception. | 131 // Return value: none, throws an exception. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 178 |
178 // Rethrow an error with a stacktrace. | 179 // Rethrow an error with a stacktrace. |
179 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { | 180 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { |
180 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); | 181 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); |
181 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); | 182 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); |
182 Exceptions::ReThrow(thread, error, stacktrace); | 183 Exceptions::ReThrow(thread, error, stacktrace); |
183 return Object::null(); | 184 return Object::null(); |
184 } | 185 } |
185 | 186 |
186 } // namespace dart | 187 } // namespace dart |
OLD | NEW |