| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 CHECK_RESULT(builtin_lib); | 537 CHECK_RESULT(builtin_lib); |
| 538 | 538 |
| 539 // Prepare for script loading by setting up the 'print' and 'timer' | 539 // Prepare for script loading by setting up the 'print' and 'timer' |
| 540 // closures and setting up 'package root' for URI resolution. | 540 // closures and setting up 'package root' for URI resolution. |
| 541 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib); | 541 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib); |
| 542 CHECK_RESULT(result); | 542 CHECK_RESULT(result); |
| 543 | 543 |
| 544 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(data); | 544 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(data); |
| 545 ASSERT(isolate_data != NULL); | 545 ASSERT(isolate_data != NULL); |
| 546 ASSERT(isolate_data->script_url != NULL); | 546 ASSERT(isolate_data->script_url != NULL); |
| 547 Dart_Handle library = DartUtils::LoadScript(isolate_data->script_url, | 547 result = DartUtils::LoadScript(isolate_data->script_url, builtin_lib); |
| 548 builtin_lib); | 548 CHECK_RESULT(result); |
| 549 CHECK_RESULT(library); | |
| 550 if (!Dart_IsLibrary(library)) { | |
| 551 char errbuf[256]; | |
| 552 snprintf(errbuf, sizeof(errbuf), | |
| 553 "Expected a library when loading script: %s", | |
| 554 script_uri); | |
| 555 *error = strdup(errbuf); | |
| 556 Dart_ExitScope(); | |
| 557 Dart_ShutdownIsolate(); | |
| 558 return NULL; | |
| 559 } | |
| 560 | 549 |
| 550 result = Dart_RunLoop(); |
| 551 CHECK_RESULT(result); |
| 561 | 552 |
| 562 Platform::SetPackageRoot(package_root); | 553 Platform::SetPackageRoot(package_root); |
| 563 Dart_Handle io_lib_url = DartUtils::NewString(DartUtils::kIOLibURL); | 554 Dart_Handle io_lib_url = DartUtils::NewString(DartUtils::kIOLibURL); |
| 564 CHECK_RESULT(io_lib_url); | 555 CHECK_RESULT(io_lib_url); |
| 565 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); | 556 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); |
| 566 CHECK_RESULT(io_lib); | 557 CHECK_RESULT(io_lib); |
| 567 Dart_Handle platform_type = DartUtils::GetDartType(DartUtils::kIOLibURL, | 558 Dart_Handle platform_type = DartUtils::GetDartType(DartUtils::kIOLibURL, |
| 568 "Platform"); | 559 "Platform"); |
| 569 CHECK_RESULT(platform_type); | 560 CHECK_RESULT(platform_type); |
| 570 Dart_Handle script_name = DartUtils::NewString("_nativeScript"); | 561 Dart_Handle script_name = DartUtils::NewString("_nativeScript"); |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 exit(Process::GlobalExitCode()); | 1127 exit(Process::GlobalExitCode()); |
| 1137 } | 1128 } |
| 1138 | 1129 |
| 1139 } // namespace bin | 1130 } // namespace bin |
| 1140 } // namespace dart | 1131 } // namespace dart |
| 1141 | 1132 |
| 1142 int main(int argc, char** argv) { | 1133 int main(int argc, char** argv) { |
| 1143 dart::bin::main(argc, argv); | 1134 dart::bin::main(argc, argv); |
| 1144 UNREACHABLE(); | 1135 UNREACHABLE(); |
| 1145 } | 1136 } |
| OLD | NEW |