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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2093813002: Allow null in Dart_SetRootLibrary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months 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 | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index b9e9f554cd6c77f0784ed35103fa138a4c8e61b2..597bae21cd47885eb3d9d4c92c72c279e1a6f33d 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5335,13 +5335,14 @@ DART_EXPORT Dart_Handle Dart_RootLibrary() {
DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) {
DARTSCOPE(Thread::Current());
- const Library& lib = Api::UnwrapLibraryHandle(Z, library);
- if (lib.IsNull()) {
- RETURN_TYPE_ERROR(Z, library, Library);
- }
- Isolate* isolate = Isolate::Current();
- isolate->object_store()->set_root_library(lib);
- return library;
+ const Object& obj = Object::Handle(Z, Api::UnwrapHandle(library));
+ if (obj.IsNull() || obj.IsLibrary()) {
+ Library& lib = Library::Handle(Z);
+ lib ^= obj.raw();
+ T->isolate()->object_store()->set_root_library(lib);
+ return library;
+ }
+ RETURN_TYPE_ERROR(Z, library, Library);
}
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698