Index: runtime/bin/main.cc |
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc |
index d829587c59589dec5a673a598426aecf7591af58..1429ff4e65315ec2d5760de07f3f8c92ad1eebbc 100644 |
--- a/runtime/bin/main.cc |
+++ b/runtime/bin/main.cc |
@@ -706,6 +706,7 @@ static Dart_Handle EnvironmentCallback(Dart_Handle name) { |
static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri, |
const char* main, |
const char* package_root, |
+ const char** package_map, |
const char* packages_file, |
Dart_IsolateFlags* flags, |
char** error, |
@@ -767,6 +768,7 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri, |
// Prepare for script loading by setting up the 'print' and 'timer' |
// closures and setting up 'package root' for URI resolution. |
result = DartUtils::PrepareForScriptLoading(package_root, |
+ package_map, |
packages_file, |
false, |
has_trace_loading, |
@@ -815,13 +817,18 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri, |
static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, |
const char* main, |
const char* package_root, |
+ const char** package_map, |
Dart_IsolateFlags* flags, |
void* data, char** error) { |
// The VM should never call the isolate helper with a NULL flags. |
ASSERT(flags != NULL); |
ASSERT(flags->version == DART_FLAGS_CURRENT_VERSION); |
+ if ((package_root != NULL) && (package_map != NULL)) { |
+ *error = strdup("Invalid arguments - Cannot simultaneously specify " |
+ "package root and package map."); |
+ return NULL; |
+ } |
IsolateData* parent_isolate_data = reinterpret_cast<IsolateData*>(data); |
- int exit_code = 0; |
if (script_uri == NULL) { |
if (data == NULL) { |
*error = strdup("Invalid 'callback_data' - Unable to spawn new isolate"); |
@@ -834,15 +841,20 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, |
} |
} |
const char* packages_file = NULL; |
- if (package_root == NULL) { |
+ // If neither a package root nor a package map are requested pass on the |
+ // inherited values. |
+ if ((package_root == NULL) && (package_map == NULL)) { |
if (parent_isolate_data != NULL) { |
package_root = parent_isolate_data->package_root; |
packages_file = parent_isolate_data->packages_file; |
} |
} |
+ |
+ int exit_code = 0; |
return CreateIsolateAndSetupHelper(script_uri, |
main, |
package_root, |
+ package_map, |
packages_file, |
flags, |
error, |
@@ -1116,6 +1128,7 @@ bool RunMainIsolate(const char* script_name, |
Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, |
"main", |
commandline_package_root, |
+ NULL, |
commandline_packages_file, |
NULL, |
&error, |