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

Unified Diff: vm/dart_api_impl.cc

Issue 9447041: Allow Dart_Null to be passed in for the import map in Dart_LoadLibrary and Dart_LoadScript. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 10 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 | vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_impl.cc
===================================================================
--- vm/dart_api_impl.cc (revision 4552)
+++ vm/dart_api_impl.cc (working copy)
@@ -2451,9 +2451,6 @@
RETURN_TYPE_ERROR(source, String);
}
const Array& mapping_array = Api::UnwrapArrayHandle(import_map);
- if (mapping_array.IsNull()) {
- RETURN_TYPE_ERROR(import_map, Array);
- }
Library& library = Library::Handle(isolate->object_store()->root_library());
if (!library.IsNull()) {
const String& library_url = String::Handle(library.url());
@@ -2462,7 +2459,11 @@
}
isolate->set_library_tag_handler(handler);
library = Library::New(url_str);
- library.set_import_map(mapping_array);
+ if (mapping_array.IsNull()) {
+ library.set_import_map(Array::Handle(Array::Empty()));
+ } else {
+ library.set_import_map(mapping_array);
+ }
library.Register();
isolate->object_store()->set_root_library(library);
Dart_Handle result;
@@ -2603,13 +2604,14 @@
RETURN_TYPE_ERROR(source, String);
}
const Array& mapping_array = Api::UnwrapArrayHandle(import_map);
- if (mapping_array.IsNull()) {
- RETURN_TYPE_ERROR(import_map, Array);
- }
Library& library = Library::Handle(Library::LookupLibrary(url_str));
if (library.IsNull()) {
library = Library::New(url_str);
- library.set_import_map(mapping_array);
+ if (mapping_array.IsNull()) {
+ library.set_import_map(Array::Handle(Array::Empty()));
+ } else {
+ library.set_import_map(mapping_array);
+ }
library.Register();
} else if (!library.LoadNotStarted()) {
// The source for this library has either been loaded or is in the
« no previous file with comments | « no previous file | vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698