| 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_, patch_url_, patch_source_, has_natives_ } */ | 14 /* { url_, source_, patch_url_, patch_source_, has_natives_ } */ |
| 15 { DartUtils::kBuiltinLibURL, builtin_source_, NULL, NULL, true }, | 15 { DartUtils::kBuiltinLibURL, builtin_source_, NULL, NULL, true }, |
| 16 { DartUtils::kJsonLibURL, json_source_, NULL, NULL, false }, | |
| 17 { DartUtils::kUriLibURL, uri_source_, NULL, NULL, false }, | |
| 18 { DartUtils::kCryptoLibURL, crypto_source_, NULL, NULL, false }, | |
| 19 { DartUtils::kIOLibURL, io_source_, | 16 { DartUtils::kIOLibURL, io_source_, |
| 20 DartUtils::kIOLibPatchURL, io_patch_, true }, | 17 DartUtils::kIOLibPatchURL, io_patch_, true }, |
| 21 { DartUtils::kUtfLibURL, utf_source_, NULL, NULL, false } | |
| 22 }; | 18 }; |
| 23 | 19 |
| 24 | 20 |
| 25 Dart_Handle Builtin::Source(BuiltinLibraryId id) { | 21 Dart_Handle Builtin::Source(BuiltinLibraryId id) { |
| 26 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == | 22 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == |
| 27 kInvalidLibrary); | 23 kInvalidLibrary); |
| 28 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); | 24 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); |
| 29 return DartUtils::NewString(builtin_libraries_[id].source_); | 25 return DartUtils::NewString(builtin_libraries_[id].source_); |
| 30 } | 26 } |
| 31 | 27 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 62 Dart_Handle patch_url = | 58 Dart_Handle patch_url = |
| 63 DartUtils::NewString(builtin_libraries_[id].patch_url_); | 59 DartUtils::NewString(builtin_libraries_[id].patch_url_); |
| 64 Dart_Handle patch_source = | 60 Dart_Handle patch_source = |
| 65 DartUtils::NewString(builtin_libraries_[id].patch_source_); | 61 DartUtils::NewString(builtin_libraries_[id].patch_source_); |
| 66 DART_CHECK_VALID(Dart_LoadPatch(library, patch_url, patch_source)); | 62 DART_CHECK_VALID(Dart_LoadPatch(library, patch_url, patch_source)); |
| 67 } | 63 } |
| 68 } | 64 } |
| 69 DART_CHECK_VALID(library); | 65 DART_CHECK_VALID(library); |
| 70 return library; | 66 return library; |
| 71 } | 67 } |
| OLD | NEW |