| 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 "lib/error.h" | 5 #include "lib/error.h" |
| 6 | 6 |
| 7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
| 8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // Return value: none, throws an exception. | 58 // Return value: none, throws an exception. |
| 59 DEFINE_NATIVE_ENTRY(TypeError_throwNew, 5) { | 59 DEFINE_NATIVE_ENTRY(TypeError_throwNew, 5) { |
| 60 // No need to type check the arguments. This function can only be called | 60 // No need to type check the arguments. This function can only be called |
| 61 // internally from the VM. | 61 // internally from the VM. |
| 62 intptr_t location = Smi::CheckedHandle(arguments->At(0)).Value(); | 62 intptr_t location = Smi::CheckedHandle(arguments->At(0)).Value(); |
| 63 const Instance& src_value = Instance::CheckedHandle(arguments->At(1)); | 63 const Instance& src_value = Instance::CheckedHandle(arguments->At(1)); |
| 64 const String& dst_type_name = String::CheckedHandle(arguments->At(2)); | 64 const String& dst_type_name = String::CheckedHandle(arguments->At(2)); |
| 65 const String& dst_name = String::CheckedHandle(arguments->At(3)); | 65 const String& dst_name = String::CheckedHandle(arguments->At(3)); |
| 66 const String& malformed_error = String::CheckedHandle(arguments->At(4)); | 66 const String& malformed_error = String::CheckedHandle(arguments->At(4)); |
| 67 const String& src_type_name = | 67 const String& src_type_name = |
| 68 String::Handle(Type::Handle(src_value.GetType()).Name()); | 68 String::Handle(Type::Handle(src_value.GetType()).UserVisibleName()); |
| 69 Exceptions::CreateAndThrowTypeError(location, src_type_name, | 69 Exceptions::CreateAndThrowTypeError(location, src_type_name, |
| 70 dst_type_name, dst_name, malformed_error); | 70 dst_type_name, dst_name, malformed_error); |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 // Allocate and throw a new FallThroughError. | 74 // Allocate and throw a new FallThroughError. |
| 75 // Arg0: index of the case clause token into which we fall through. | 75 // Arg0: index of the case clause token into which we fall through. |
| 76 // Return value: none, throws an exception. | 76 // Return value: none, throws an exception. |
| 77 DEFINE_NATIVE_ENTRY(FallThroughError_throwNew, 1) { | 77 DEFINE_NATIVE_ENTRY(FallThroughError_throwNew, 1) { |
| 78 GET_NATIVE_ARGUMENT(Smi, smi_pos, arguments->At(0)); | 78 GET_NATIVE_ARGUMENT(Smi, smi_pos, arguments->At(0)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 intptr_t line, column; | 122 intptr_t line, column; |
| 123 script.GetTokenLocation(call_pos, &line, &column); | 123 script.GetTokenLocation(call_pos, &line, &column); |
| 124 Exceptions::SetField(resolution_exception, cls, "failedResolutionLine", | 124 Exceptions::SetField(resolution_exception, cls, "failedResolutionLine", |
| 125 String::Handle(script.GetLine(line))); | 125 String::Handle(script.GetLine(line))); |
| 126 | 126 |
| 127 Exceptions::Throw(resolution_exception); | 127 Exceptions::Throw(resolution_exception); |
| 128 UNREACHABLE(); | 128 UNREACHABLE(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace dart | 131 } // namespace dart |
| OLD | NEW |