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

Unified Diff: vm/dart_api_impl.cc

Issue 9359009: Implement support for specifying string interopolation style variable substitution in the import ... (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 | « include/dart_api.h ('k') | vm/dart_api_impl_test.cc » ('j') | vm/object.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_impl.cc
===================================================================
--- vm/dart_api_impl.cc (revision 3975)
+++ vm/dart_api_impl.cc (working copy)
@@ -2176,7 +2176,8 @@
DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
Dart_Handle source,
- Dart_LibraryTagHandler handler) {
+ Dart_LibraryTagHandler handler,
+ Dart_Handle import_map) {
TIMERSCOPE(time_script_loading);
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
@@ -2188,6 +2189,10 @@
if (source_str.IsNull()) {
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());
@@ -2196,6 +2201,7 @@
}
isolate->set_library_tag_handler(handler);
library = Library::New(url_str);
+ library.set_import_map(mapping_array);
library.Register();
isolate->object_store()->set_root_library(library);
Dart_Handle result;
@@ -2321,7 +2327,9 @@
}
-DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, Dart_Handle source) {
+DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url,
+ Dart_Handle source,
+ Dart_Handle import_map) {
TIMERSCOPE(time_script_loading);
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
@@ -2333,9 +2341,14 @@
if (source_str.IsNull()) {
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);
library.Register();
} else if (!library.LoadNotStarted()) {
// The source for this library has either been loaded or is in the
« no previous file with comments | « include/dart_api.h ('k') | vm/dart_api_impl_test.cc » ('j') | vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698