| 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 if (tag != kImportTag) { | 463 if (tag != kImportTag) { |
| 464 return Dart_Error("Dart extensions must use import: '%s'", url_string); | 464 return Dart_Error("Dart extensions must use import: '%s'", url_string); |
| 465 } | 465 } |
| 466 return Extensions::LoadExtension(url_string, library); | 466 return Extensions::LoadExtension(url_string, library); |
| 467 } | 467 } |
| 468 result = DartUtils::LoadSource(NULL, | 468 result = DartUtils::LoadSource(NULL, |
| 469 library, | 469 library, |
| 470 url, | 470 url, |
| 471 tag, | 471 tag, |
| 472 url_string); | 472 url_string); |
| 473 if (!Dart_IsError(result) && (tag == kImportTag)) { | |
| 474 Builtin::ImportLibrary(result, Builtin::kBuiltinLibrary); | |
| 475 } | |
| 476 return result; | 473 return result; |
| 477 } | 474 } |
| 478 | 475 |
| 479 | 476 |
| 480 static Dart_Handle ReadSource(Dart_Handle script_uri, | 477 static Dart_Handle ReadSource(Dart_Handle script_uri, |
| 481 Dart_Handle builtin_lib) { | 478 Dart_Handle builtin_lib) { |
| 482 Dart_Handle script_path = FilePathFromUri(script_uri, builtin_lib); | 479 Dart_Handle script_path = FilePathFromUri(script_uri, builtin_lib); |
| 483 if (Dart_IsError(script_path)) { | 480 if (Dart_IsError(script_path)) { |
| 484 return script_path; | 481 return script_path; |
| 485 } | 482 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 if (!Dart_IsLibrary(library)) { | 626 if (!Dart_IsLibrary(library)) { |
| 630 char errbuf[256]; | 627 char errbuf[256]; |
| 631 snprintf(errbuf, sizeof(errbuf), | 628 snprintf(errbuf, sizeof(errbuf), |
| 632 "Expected a library when loading script: %s", | 629 "Expected a library when loading script: %s", |
| 633 script_uri); | 630 script_uri); |
| 634 *error = strdup(errbuf); | 631 *error = strdup(errbuf); |
| 635 Dart_ExitScope(); | 632 Dart_ExitScope(); |
| 636 Dart_ShutdownIsolate(); | 633 Dart_ShutdownIsolate(); |
| 637 return false; | 634 return false; |
| 638 } | 635 } |
| 639 // Implicitly import builtin into app. | |
| 640 Builtin::ImportLibrary(library, Builtin::kBuiltinLibrary); | |
| 641 Dart_ExitScope(); | 636 Dart_ExitScope(); |
| 642 return true; | 637 return true; |
| 643 } | 638 } |
| 644 | 639 |
| 645 | 640 |
| 646 static bool CreateIsolateAndSetup(const char* script_uri, | 641 static bool CreateIsolateAndSetup(const char* script_uri, |
| 647 const char* main, | 642 const char* main, |
| 648 void* data, char** error) { | 643 void* data, char** error) { |
| 649 return CreateIsolateAndSetupHelper(script_uri, | 644 return CreateIsolateAndSetupHelper(script_uri, |
| 650 main, | 645 main, |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 DumpPprofSymbolInfo(); | 848 DumpPprofSymbolInfo(); |
| 854 // Shutdown the isolate. | 849 // Shutdown the isolate. |
| 855 Dart_ShutdownIsolate(); | 850 Dart_ShutdownIsolate(); |
| 856 // Terminate process exit-code handler. | 851 // Terminate process exit-code handler. |
| 857 Process::TerminateExitCodeHandler(); | 852 Process::TerminateExitCodeHandler(); |
| 858 | 853 |
| 859 free(const_cast<char*>(original_working_directory)); | 854 free(const_cast<char*>(original_working_directory)); |
| 860 | 855 |
| 861 return 0; | 856 return 0; |
| 862 } | 857 } |
| OLD | NEW |