Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Unified Diff: runtime/vm/object.cc

Issue 8501034: Deal with unhandled exceptions the same way in all Dart api functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 1469)
+++ runtime/vm/object.cc (working copy)
@@ -74,7 +74,7 @@
reinterpret_cast<RawClass*>(RAW_NULL);
RawClass* Object::context_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
RawClass* Object::context_scope_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
-RawClass* Object::api_failure_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
+RawClass* Object::api_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
#undef RAW_NULL
int Object::GetSingletonClassIndex(const RawClass* raw_class) {
@@ -125,8 +125,8 @@
return kContextClass;
} else if (raw_class == context_scope_class()) {
return kContextScopeClass;
- } else if (raw_class == api_failure_class()) {
- return kApiFailureClass;
+ } else if (raw_class == api_error_class()) {
+ return kApiErrorClass;
}
return kInvalidIndex;
}
@@ -158,7 +158,7 @@
case kExceptionHandlersClass: return exception_handlers_class();
case kContextClass: return context_class();
case kContextScopeClass: return context_scope_class();
- case kApiFailureClass: return api_failure_class();
+ case kApiErrorClass: return api_error_class();
default: break;
}
UNREACHABLE();
@@ -191,7 +191,7 @@
case kExceptionHandlersClass: return "ExceptionHandlers";
case kContextClass: return "Context";
case kContextScopeClass: return "ContextScope";
- case kApiFailureClass: return "ApiFailure";
+ case kApiErrorClass: return "ApiError";
default: break;
}
UNREACHABLE();
@@ -328,8 +328,8 @@
cls = Class::New<ContextScope>();
context_scope_class_ = cls.raw();
- cls = Class::New<ApiFailure>();
- api_failure_class_ = cls.raw();
+ cls = Class::New<ApiError>();
+ api_error_class_ = cls.raw();
ASSERT(class_class() != null_);
}
@@ -4748,31 +4748,47 @@
}
-RawApiFailure* ApiFailure::New(const String& message, Heap::Space space) {
- const Class& cls = Class::Handle(Object::api_failure_class());
- ApiFailure& result = ApiFailure::Handle();
+RawApiError* ApiError::New(const String& message, Heap::Space space) {
+ const Class& cls = Class::Handle(Object::api_error_class());
+ ApiError& result = ApiError::Handle();
{
RawObject* raw = Object::Allocate(cls,
- ApiFailure::InstanceSize(),
+ ApiError::InstanceSize(),
space);
NoGCScope no_gc;
result ^= raw;
}
- result.set_message(message);
+ result.set_data(message);
return result.raw();
}
-void ApiFailure::set_message(const String& message) const {
- StorePointer(&raw_ptr()->message_, message.raw());
+RawApiError* ApiError::New(const UnhandledException& exception,
+ Heap::Space space) {
+ const Class& cls = Class::Handle(Object::api_error_class());
+ ApiError& result = ApiError::Handle();
+ {
+ RawObject* raw = Object::Allocate(cls,
+ ApiError::InstanceSize(),
+ space);
+ NoGCScope no_gc;
+ result ^= raw;
+ }
+ result.set_data(exception);
+ return result.raw();
}
-const char* ApiFailure::ToCString() const {
- return "ApiFailure";
+void ApiError::set_data(const Object& data) const {
+ StorePointer(&raw_ptr()->data_, data.raw());
}
+const char* ApiError::ToCString() const {
+ return "ApiError";
+}
+
+
bool Instance::Equals(const Instance& other) const {
if (this->raw() == other.raw()) {
return true; // "===".
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698