| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 | 41 |
| 42 void Builtin::SetupLibrary(Dart_Handle library, BuiltinLibraryId id) { | 42 void Builtin::SetupLibrary(Dart_Handle library, BuiltinLibraryId id) { |
| 43 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == | 43 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == |
| 44 kInvalidLibrary); | 44 kInvalidLibrary); |
| 45 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); | 45 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); |
| 46 if (builtin_libraries_[id].has_natives_) { | 46 if (builtin_libraries_[id].has_natives_) { |
| 47 // Setup the native resolver for built in library functions. | 47 // Setup the native resolver for built in library functions. |
| 48 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup)); | 48 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup)); |
| 49 } | 49 } |
| 50 // TODO(ager): I don't think you ever need to import the builtin |
| 51 // library anywhere now, right? |
| 50 if (id == kBuiltinLibrary) { | 52 if (id == kBuiltinLibrary) { |
| 51 // Import the builtin library into the core and isolate libraries. | 53 // Import the builtin library into the core and isolate libraries. |
| 52 ImportBuiltinLibIntoLib(DartUtils::kCoreLibURL, library); | 54 ImportBuiltinLibIntoLib(DartUtils::kCoreLibURL, library); |
| 53 ImportBuiltinLibIntoLib(DartUtils::kCoreImplLibURL, library); | 55 ImportBuiltinLibIntoLib(DartUtils::kCoreImplLibURL, library); |
| 54 ImportBuiltinLibIntoLib(DartUtils::kIsolateLibURL, library); | 56 ImportBuiltinLibIntoLib(DartUtils::kIsolateLibURL, library); |
| 55 } | 57 } |
| 56 } | 58 } |
| 57 | 59 |
| 58 | 60 |
| 59 Dart_Handle Builtin::LoadLibrary(BuiltinLibraryId id) { | 61 Dart_Handle Builtin::LoadLibrary(BuiltinLibraryId id) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 } | 75 } |
| 74 | 76 |
| 75 | 77 |
| 76 void Builtin::ImportLibrary(Dart_Handle library, BuiltinLibraryId id) { | 78 void Builtin::ImportLibrary(Dart_Handle library, BuiltinLibraryId id) { |
| 77 Dart_Handle imported_library = LoadLibrary(id); | 79 Dart_Handle imported_library = LoadLibrary(id); |
| 78 // Import the library into current library. | 80 // Import the library into current library. |
| 79 DART_CHECK_VALID(Dart_LibraryImportLibrary(library, | 81 DART_CHECK_VALID(Dart_LibraryImportLibrary(library, |
| 80 imported_library, | 82 imported_library, |
| 81 Dart_Null())); | 83 Dart_Null())); |
| 82 } | 84 } |
| OLD | NEW |