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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2933603002: 1. Dynamic compute the main closure that needs to be run by the main isolate (Closed)
Patch Set: Address review comments. Created 3 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
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index f32f9594422257aa91e1b6401fc7d2e9cbb0392e..cd8c54e63d24162755b57a0c800a6344f0c6a839 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -2343,6 +2343,21 @@ DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj,
}
+DART_EXPORT Dart_Handle Dart_GetClosure(Dart_Handle library,
+ Dart_Handle function_name) {
+ DARTSCOPE(Thread::Current());
+ const Library& lib = Api::UnwrapLibraryHandle(Z, library);
+ if (lib.IsNull()) {
+ RETURN_TYPE_ERROR(Z, library, Library);
+ }
+ const String& name = Api::UnwrapStringHandle(Z, function_name);
+ if (name.IsNull()) {
+ RETURN_TYPE_ERROR(Z, function_name, String);
+ }
+ return Api::NewHandle(T, lib.GetFunctionClosure(name));
+}
+
+
// --- Booleans ----
DART_EXPORT Dart_Handle Dart_True() {
@@ -5422,6 +5437,9 @@ DART_EXPORT Dart_Handle Dart_LoadKernel(void* kernel_program) {
if (tmp.IsError()) {
return Api::NewHandle(T, tmp.raw());
}
+ // TODO(kernel): Setting root library based on whether it has 'main' or not
+ // is not correct because main can be in the exported namespace of a library
+ // or it could be a getter.
if (tmp.IsNull()) {
return Api::NewError("%s: The binary program does not contain 'main'.",
CURRENT_FUNC);

Powered by Google App Engine
This is Rietveld 408576698