| 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_, patch_url_, patch_source_, has_natives_ } */ |
| 15 { DartUtils::kBuiltinLibURL, NULL, true }, | 15 { DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true }, |
| 16 { DartUtils::kJsonLibURL, NULL, false }, | 16 { DartUtils::kJsonLibURL, NULL, NULL, NULL, false }, |
| 17 { DartUtils::kUriLibURL, NULL, false }, | 17 { DartUtils::kUriLibURL, NULL, NULL, NULL, false }, |
| 18 { DartUtils::kCryptoLibURL, NULL, false }, | 18 { DartUtils::kCryptoLibURL, NULL, NULL, NULL, false }, |
| 19 { DartUtils::kIOLibURL, NULL, true }, | 19 { DartUtils::kIOLibURL, NULL, NULL, NULL, true }, |
| 20 { DartUtils::kUtfLibURL, NULL, false } | 20 { DartUtils::kUtfLibURL, NULL, NULL, NULL, false } |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 | 23 |
| 24 Dart_Handle Builtin::Source(BuiltinLibraryId id) { | 24 Dart_Handle Builtin::Source(BuiltinLibraryId id) { |
| 25 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == | 25 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == |
| 26 kInvalidLibrary); | 26 kInvalidLibrary); |
| 27 return Dart_NewApiError("Unreachable code in Builtin::Source (%d).", id); | 27 return Dart_NewApiError("Unreachable code in Builtin::Source (%d).", id); |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 52 ASSERT(id > kUtfLibrary); | 52 ASSERT(id > kUtfLibrary); |
| 53 library = Dart_LoadLibrary(url, Source(id)); | 53 library = Dart_LoadLibrary(url, Source(id)); |
| 54 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) { | 54 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) { |
| 55 // Setup the native resolver for built in library functions. | 55 // Setup the native resolver for built in library functions. |
| 56 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup)); | 56 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup)); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 DART_CHECK_VALID(library); | 59 DART_CHECK_VALID(library); |
| 60 return library; | 60 return library; |
| 61 } | 61 } |
| OLD | NEW |