| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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)); |
| 79 intptr_t fallthrough_pos = smi_pos.Value(); | 79 intptr_t fallthrough_pos = smi_pos.Value(); |
| 80 | 80 |
| 81 // Allocate a new instance of type FallThroughError. | 81 // Allocate a new instance of type FallThroughError. |
| 82 const Instance& fallthrough_error = | 82 const Instance& fallthrough_error = Instance::Handle(Exceptions::NewInstance( |
| 83 Instance::Handle(Exceptions::NewInstance("FallThroughError")); | 83 "FallThroughErrorImplementation")); |
| 84 ASSERT(!fallthrough_error.IsNull()); | 84 ASSERT(!fallthrough_error.IsNull()); |
| 85 | 85 |
| 86 // Initialize 'url' and 'line' fields. | 86 // Initialize 'url' and 'line' fields. |
| 87 DartFrameIterator iterator; | 87 DartFrameIterator iterator; |
| 88 iterator.NextFrame(); // Skip native call. | 88 iterator.NextFrame(); // Skip native call. |
| 89 const Script& script = Script::Handle(Exceptions::GetCallerScript(&iterator)); | 89 const Script& script = Script::Handle(Exceptions::GetCallerScript(&iterator)); |
| 90 const Class& cls = Class::Handle(fallthrough_error.clazz()); | 90 const Class& cls = Class::Handle(fallthrough_error.clazz()); |
| 91 Exceptions::SetField(fallthrough_error, cls, "url", | 91 Exceptions::SetField(fallthrough_error, cls, "url", |
| 92 String::Handle(script.url())); | 92 String::Handle(script.url())); |
| 93 intptr_t line, column; | 93 intptr_t line, column; |
| (...skipping 28 matching lines...) Expand all 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 |