| Index: runtime/bin/dartutils.cc
|
| ===================================================================
|
| --- runtime/bin/dartutils.cc (revision 38484)
|
| +++ runtime/bin/dartutils.cc (working copy)
|
| @@ -781,30 +781,31 @@
|
|
|
| Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root,
|
| Dart_Handle builtin_lib) {
|
| + // First ensure all required libraries are available.
|
| + Dart_Handle url = NewString(kAsyncLibURL);
|
| + DART_CHECK_VALID(url);
|
| + Dart_Handle async_lib = Dart_LookupLibrary(url);
|
| + DART_CHECK_VALID(async_lib);
|
| + Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
|
| +
|
| + // We need to ensure that all the scripts loaded so far are finalized
|
| + // as we are about to invoke some Dart code below to setup closures.
|
| + Dart_Handle result = Dart_FinalizeLoading(false);
|
| + DART_CHECK_VALID(result);
|
| +
|
| // Setup the internal library's 'internalPrint' function.
|
| Dart_Handle print = Dart_Invoke(
|
| builtin_lib, NewString("_getPrintClosure"), 0, NULL);
|
| - Dart_Handle url = NewString(kInternalLibURL);
|
| + url = NewString(kInternalLibURL);
|
| DART_CHECK_VALID(url);
|
| Dart_Handle internal_lib = Dart_LookupLibrary(url);
|
| DART_CHECK_VALID(internal_lib);
|
| - Dart_Handle result = Dart_SetField(internal_lib,
|
| - NewString("_printClosure"),
|
| - print);
|
| + result = Dart_SetField(internal_lib,
|
| + NewString("_printClosure"),
|
| + print);
|
| DART_CHECK_VALID(result);
|
|
|
| // Setup the 'timer' factory.
|
| - url = NewString(kAsyncLibURL);
|
| - DART_CHECK_VALID(url);
|
| - Dart_Handle async_lib = Dart_LookupLibrary(url);
|
| - DART_CHECK_VALID(async_lib);
|
| - Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
|
| -
|
| - // We need to ensure that all the scripts loaded so far are finalized
|
| - // as we are about to invoke some Dart code below to setup closures.
|
| - result = Dart_FinalizeLoading(false);
|
| - DART_CHECK_VALID(result);
|
| -
|
| Dart_Handle timer_closure =
|
| Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL);
|
| Dart_Handle args[1];
|
|
|