Index: runtime/bin/main.cc |
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc |
index 61d76f7a80bf32c58a635f0493746ab9ee7dc76b..948f112894e41e69405e4caf947c01b669d3d6fe 100644 |
--- a/runtime/bin/main.cc |
+++ b/runtime/bin/main.cc |
@@ -1487,7 +1487,6 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) { |
if (gen_snapshot_kind == kAppAOT) { |
Dart_QualifiedFunctionName standalone_entry_points[] = { |
- {"dart:_builtin", "::", "_getMainClosure"}, |
{"dart:_builtin", "::", "_getPrintClosure"}, |
{"dart:_builtin", "::", "_getUriBaseClosure"}, |
{"dart:_builtin", "::", "_libraryFilePath"}, |
@@ -1571,13 +1570,16 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) { |
CHECK_RESULT(result); |
} |
- // The helper function _getMainClosure creates a closure for the main |
- // entry point which is either explicitly or implictly exported from the |
- // root library. |
+ // Create a closure for the main entry point which is in the exported |
+ // namespace of the root library or invoke a getter of the same name |
+ // in the exported namespace and return the resulting closure. |
Dart_Handle main_closure = |
- Dart_Invoke(isolate_data->builtin_lib(), |
- Dart_NewStringFromCString("_getMainClosure"), 0, NULL); |
+ Dart_GetClosure(root_lib, Dart_NewStringFromCString("main")); |
CHECK_RESULT(main_closure); |
+ if (!Dart_IsClosure(main_closure)) { |
+ ErrorExit(kErrorExitCode, |
+ "Unable to find 'main' in root library '%s'\n", script_name); |
+ } |
// Call _startIsolate in the isolate library to enable dispatching the |
// initial startup message. |