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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Exceptions::SetField(error, cls, "line", Smi::Handle(Smi::New(line))); | 134 Exceptions::SetField(error, cls, "line", Smi::Handle(Smi::New(line))); |
135 Exceptions::SetField(error, cls, "className", class_name); | 135 Exceptions::SetField(error, cls, "className", class_name); |
136 | 136 |
137 // Throw AbstractClassInstantiationError instance. | 137 // Throw AbstractClassInstantiationError instance. |
138 Exceptions::Throw(error); | 138 Exceptions::Throw(error); |
139 UNREACHABLE(); | 139 UNREACHABLE(); |
140 return Object::null(); | 140 return Object::null(); |
141 } | 141 } |
142 | 142 |
143 | 143 |
| 144 // TODO(regis): This helper is used to compile a throw when a call cannot be |
| 145 // resolved at compile time. The thrown instance of NoSuchMethodError is of a |
| 146 // different type than a NoSuchMethodError thrown at runtime. This should be |
| 147 // merged. |
| 148 // |
144 // Allocate and throw NoSuchMethodError. | 149 // Allocate and throw NoSuchMethodError. |
145 // Arg0: index of the call that was not resolved at compile time. | 150 // Arg0: index of the call that was not resolved at compile time. |
146 // Arg1: name of the method that was not resolved at compile time. | 151 // Arg1: name of the method that was not resolved at compile time. |
147 // Return value: none, throws an exception. | 152 // Return value: none, throws an exception. |
148 DEFINE_NATIVE_ENTRY(NoSuchMethodError_throwNew, 2) { | 153 DEFINE_NATIVE_ENTRY(NoSuchMethodError_throwNew, 2) { |
149 GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_pos, arguments->NativeArgAt(0)); | 154 GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_pos, arguments->NativeArgAt(0)); |
150 GET_NON_NULL_NATIVE_ARGUMENT( | 155 GET_NON_NULL_NATIVE_ARGUMENT( |
151 String, function_name, arguments->NativeArgAt(1)); | 156 String, function_name, arguments->NativeArgAt(1)); |
152 intptr_t call_pos = smi_pos.Value(); | 157 intptr_t call_pos = smi_pos.Value(); |
153 // Allocate a new instance of type NoSuchMethodError. | 158 // Allocate a new instance of type NoSuchMethodError. |
(...skipping 13 matching lines...) Expand all Loading... |
167 script.GetTokenLocation(call_pos, &line, &column); | 172 script.GetTokenLocation(call_pos, &line, &column); |
168 Exceptions::SetField(error, cls, "failedResolutionLine", | 173 Exceptions::SetField(error, cls, "failedResolutionLine", |
169 String::Handle(script.GetLine(line))); | 174 String::Handle(script.GetLine(line))); |
170 | 175 |
171 Exceptions::Throw(error); | 176 Exceptions::Throw(error); |
172 UNREACHABLE(); | 177 UNREACHABLE(); |
173 return Object::null(); | 178 return Object::null(); |
174 } | 179 } |
175 | 180 |
176 } // namespace dart | 181 } // namespace dart |
OLD | NEW |