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/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 OS::Print(" test type: %s\n", String::Handle(type.Name()).ToCString()); | 186 OS::Print(" test type: %s\n", String::Handle(type.Name()).ToCString()); |
187 if (!bound_error.IsNull()) { | 187 if (!bound_error.IsNull()) { |
188 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); | 188 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); |
189 } | 189 } |
190 } | 190 } |
191 if (!is_instance_of && !bound_error.IsNull()) { | 191 if (!is_instance_of && !bound_error.IsNull()) { |
192 // Throw a dynamic type error only if the instanceof test fails. | 192 // Throw a dynamic type error only if the instanceof test fails. |
193 DartFrameIterator iterator; | 193 DartFrameIterator iterator; |
194 StackFrame* caller_frame = iterator.NextFrame(); | 194 StackFrame* caller_frame = iterator.NextFrame(); |
195 ASSERT(caller_frame != NULL); | 195 ASSERT(caller_frame != NULL); |
196 const intptr_t location = caller_frame->GetTokenPos(); | 196 const TokenPosition location = caller_frame->GetTokenPos(); |
197 String& bound_error_message = String::Handle( | 197 String& bound_error_message = String::Handle( |
198 zone, String::New(bound_error.ToErrorCString())); | 198 zone, String::New(bound_error.ToErrorCString())); |
199 Exceptions::CreateAndThrowTypeError( | 199 Exceptions::CreateAndThrowTypeError( |
200 location, Symbols::Empty(), Symbols::Empty(), | 200 location, Symbols::Empty(), Symbols::Empty(), |
201 Symbols::Empty(), bound_error_message); | 201 Symbols::Empty(), bound_error_message); |
202 UNREACHABLE(); | 202 UNREACHABLE(); |
203 } | 203 } |
204 return Bool::Get(negate.value() ? !is_instance_of : is_instance_of).raw(); | 204 return Bool::Get(negate.value() ? !is_instance_of : is_instance_of).raw(); |
205 } | 205 } |
206 | 206 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 String::Handle(instance_type.Name()).ToCString()); | 296 String::Handle(instance_type.Name()).ToCString()); |
297 OS::Print(" cast type: %s\n", String::Handle(type.Name()).ToCString()); | 297 OS::Print(" cast type: %s\n", String::Handle(type.Name()).ToCString()); |
298 if (!bound_error.IsNull()) { | 298 if (!bound_error.IsNull()) { |
299 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); | 299 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); |
300 } | 300 } |
301 } | 301 } |
302 if (!is_instance_of) { | 302 if (!is_instance_of) { |
303 DartFrameIterator iterator; | 303 DartFrameIterator iterator; |
304 StackFrame* caller_frame = iterator.NextFrame(); | 304 StackFrame* caller_frame = iterator.NextFrame(); |
305 ASSERT(caller_frame != NULL); | 305 ASSERT(caller_frame != NULL); |
306 const intptr_t location = caller_frame->GetTokenPos(); | 306 const TokenPosition location = caller_frame->GetTokenPos(); |
307 const AbstractType& instance_type = | 307 const AbstractType& instance_type = |
308 AbstractType::Handle(instance.GetType()); | 308 AbstractType::Handle(instance.GetType()); |
309 const String& instance_type_name = | 309 const String& instance_type_name = |
310 String::Handle(instance_type.UserVisibleName()); | 310 String::Handle(instance_type.UserVisibleName()); |
311 String& type_name = String::Handle(); | 311 String& type_name = String::Handle(); |
312 if (!type.IsInstantiated()) { | 312 if (!type.IsInstantiated()) { |
313 // Instantiate type before reporting the error. | 313 // Instantiate type before reporting the error. |
314 const AbstractType& instantiated_type = AbstractType::Handle( | 314 const AbstractType& instantiated_type = AbstractType::Handle( |
315 type.InstantiateFrom(instantiator_type_arguments, NULL)); | 315 type.InstantiateFrom(instantiator_type_arguments, NULL)); |
316 // Note that instantiated_type may be malformed. | 316 // Note that instantiated_type may be malformed. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { | 384 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { |
385 #if defined(ARCH_IS_64_BIT) | 385 #if defined(ARCH_IS_64_BIT) |
386 return Bool::True().raw(); | 386 return Bool::True().raw(); |
387 #else | 387 #else |
388 return Bool::False().raw(); | 388 return Bool::False().raw(); |
389 #endif // defined(ARCH_IS_64_BIT) | 389 #endif // defined(ARCH_IS_64_BIT) |
390 } | 390 } |
391 | 391 |
392 } // namespace dart | 392 } // namespace dart |
OLD | NEW |