Index: runtime/lib/error.cc |
=================================================================== |
--- runtime/lib/error.cc (revision 11639) |
+++ runtime/lib/error.cc (working copy) |
@@ -104,7 +104,33 @@ |
return Object::null(); |
} |
regis
2012/08/31 01:16:48
Missing blank line.
Also, missing comment document
hausner
2012/08/31 18:06:52
Done.
|
+DEFINE_NATIVE_ENTRY(AbstractClassInstantiationError_throwNew, 2) { |
+ GET_NATIVE_ARGUMENT(Smi, smi_pos, arguments->At(0)); |
+ GET_NATIVE_ARGUMENT(String, class_name, arguments->At(1)); |
+ intptr_t error_pos = smi_pos.Value(); |
+ // Allocate a new instance of type AbstractClassInstantiationError. |
+ const Instance& error = Instance::Handle(Exceptions::NewInstance( |
+ "AbstractClassInstantiationErrorImplementation")); |
+ ASSERT(!error.IsNull()); |
+ |
+ // Initialize 'url', 'line' and 'className' fields. |
+ DartFrameIterator iterator; |
+ iterator.NextFrame(); // Skip native call. |
+ const Script& script = Script::Handle(Exceptions::GetCallerScript(&iterator)); |
+ const Class& cls = Class::Handle(error.clazz()); |
+ Exceptions::SetField(error, cls, "url", String::Handle(script.url())); |
+ intptr_t line, column; |
+ script.GetTokenLocation(error_pos, &line, &column); |
+ Exceptions::SetField(error, cls, "line", Smi::Handle(Smi::New(line))); |
+ Exceptions::SetField(error, cls, "className", class_name); |
+ |
+ // Throw AbstractClassInstantiationError instance. |
+ Exceptions::Throw(error); |
+ UNREACHABLE(); |
+ return Object::null(); |
+} |
+ |
regis
2012/08/31 01:16:48
Missing blank line.
hausner
2012/08/31 18:06:52
Done.
|
// Allocate and throw StaticResolutionException. |
// Arg0: index of the static call that was not resolved at compile time. |
// Return value: none, throws an exception. |