| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Handle dart scripts. | 5 // Handle dart scripts. |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 Dart_Handle canon_url = Dart_NewString(canon_url_chars); | 124 Dart_Handle canon_url = Dart_NewString(canon_url_chars); |
| 125 free(const_cast<char*>(canon_url_chars)); | 125 free(const_cast<char*>(canon_url_chars)); |
| 126 | 126 |
| 127 return canon_url; | 127 return canon_url; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // The tag is either an import or a source tag. Read the file based on the | 130 // The tag is either an import or a source tag. Read the file based on the |
| 131 // url chars. | 131 // url chars. |
| 132 Dart_Handle source = ReadStringFromFile(url_chars); | 132 Dart_Handle source = ReadStringFromFile(url_chars); |
| 133 if (!Dart_IsValid(source)) { | 133 if (!Dart_IsValid(source)) { |
| 134 return result; | 134 return source; |
| 135 } | 135 } |
| 136 if (tag == kImportTag) { | 136 if (tag == kImportTag) { |
| 137 Dart_Handle new_lib = Dart_LoadLibrary(url, source); | 137 Dart_Handle new_lib = Dart_LoadLibrary(url, source); |
| 138 if (import_builtin_lib && Dart_IsValid(new_lib)) { | 138 if (import_builtin_lib && Dart_IsValid(new_lib)) { |
| 139 Builtin_ImportLibrary(new_lib); | 139 Builtin_ImportLibrary(new_lib); |
| 140 } | 140 } |
| 141 return result; | 141 return result; |
| 142 } else if (tag == kSourceTag) { | 142 } else if (tag == kSourceTag) { |
| 143 return Dart_LoadSource(library, url, source); | 143 return Dart_LoadSource(library, url, source); |
| 144 } | 144 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 174 | 174 |
| 175 Dart_Handle LoadSnapshotCreationScript(const char* script_name) { | 175 Dart_Handle LoadSnapshotCreationScript(const char* script_name) { |
| 176 Dart_Handle source = ReadStringFromFile(script_name); | 176 Dart_Handle source = ReadStringFromFile(script_name); |
| 177 if (!Dart_IsValid(source)) { | 177 if (!Dart_IsValid(source)) { |
| 178 return source; | 178 return source; |
| 179 } | 179 } |
| 180 Dart_Handle url = Dart_NewString(script_name); | 180 Dart_Handle url = Dart_NewString(script_name); |
| 181 | 181 |
| 182 return Dart_LoadScript(url, source, CreateSnapshotLibraryTagHandler); | 182 return Dart_LoadScript(url, source, CreateSnapshotLibraryTagHandler); |
| 183 } | 183 } |
| OLD | NEW |