| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| 11 | 11 |
| 12 | 12 |
| 13 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = { | 13 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = { |
| 14 /* url_ source_ has_natives_ */ | 14 /* url_ source_ has_natives_ */ |
| 15 { DartUtils::kBuiltinLibURL, builtin_source_, true }, | 15 { DartUtils::kBuiltinLibURL, builtin_source_, true }, |
| 16 { DartUtils::kJsonLibURL, json_source_, false }, | 16 { DartUtils::kJsonLibURL, json_source_, false }, |
| 17 { DartUtils::kUriLibURL, uri_source_, false }, | 17 { DartUtils::kUriLibURL, uri_source_, false }, |
| 18 { DartUtils::kCryptoLibURL, crypto_source_, false }, | 18 { DartUtils::kCryptoLibURL, crypto_source_, false }, |
| 19 { DartUtils::kIOLibURL, io_source_, true }, | 19 { DartUtils::kIOLibURL, io_source_, true }, |
| 20 { DartUtils::kUtfLibURL, utf_source_, false }, | 20 { DartUtils::kUtfLibURL, utf_source_, false } |
| 21 { DartUtils::kWebLibURL, web_source_, false } | |
| 22 }; | 21 }; |
| 23 | 22 |
| 24 | 23 |
| 25 Dart_Handle Builtin::Source(BuiltinLibraryId id) { | 24 Dart_Handle Builtin::Source(BuiltinLibraryId id) { |
| 26 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == | 25 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == |
| 27 kInvalidLibrary); | 26 kInvalidLibrary); |
| 28 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); | 27 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); |
| 29 return Dart_NewString(builtin_libraries_[id].source_); | 28 return Dart_NewString(builtin_libraries_[id].source_); |
| 30 } | 29 } |
| 31 | 30 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 } | 57 } |
| 59 | 58 |
| 60 | 59 |
| 61 void Builtin::ImportLibrary(Dart_Handle library, BuiltinLibraryId id) { | 60 void Builtin::ImportLibrary(Dart_Handle library, BuiltinLibraryId id) { |
| 62 Dart_Handle imported_library = LoadAndCheckLibrary(id); | 61 Dart_Handle imported_library = LoadAndCheckLibrary(id); |
| 63 // Import the library into current library. | 62 // Import the library into current library. |
| 64 DART_CHECK_VALID(Dart_LibraryImportLibrary(library, | 63 DART_CHECK_VALID(Dart_LibraryImportLibrary(library, |
| 65 imported_library, | 64 imported_library, |
| 66 Dart_Null())); | 65 Dart_Null())); |
| 67 } | 66 } |
| OLD | NEW |