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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { | 113 void FUNCTION_NAME(Exit)(Dart_NativeArguments args) { |
114 Dart_EnterScope(); | 114 Dart_EnterScope(); |
115 int64_t status = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | 115 int64_t status = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); |
116 Dart_ExitScope(); | 116 Dart_ExitScope(); |
117 exit(status); | 117 exit(status); |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 void Builtin::SetNativeResolver() { | 121 void Builtin::SetNativeResolver(Builtin::BuiltinLibraryId id) { |
122 Dart_Handle url = Dart_NewString(DartUtils::kBuiltinLibURL); | 122 Dart_Handle url; |
| 123 if (id == Builtin::kBuiltinLibrary) { |
| 124 url = Dart_NewString(DartUtils::kBuiltinLibURL); |
| 125 } else { |
| 126 ASSERT(id == Builtin::kIOLibrary); |
| 127 url = Dart_NewString(DartUtils::kIOLibURL); |
| 128 } |
123 Dart_Handle builtin_lib = Dart_LookupLibrary(url); | 129 Dart_Handle builtin_lib = Dart_LookupLibrary(url); |
124 DART_CHECK_VALID(builtin_lib); | 130 DART_CHECK_VALID(builtin_lib); |
125 // Setup the native resolver for built in library functions. | 131 // Setup the native resolver for built in library functions. |
126 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); | 132 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); |
127 DART_CHECK_VALID(result); | 133 DART_CHECK_VALID(result); |
128 } | 134 } |
OLD | NEW |