| 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 #include <string.h> | 4 #include <string.h> |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 | 9 |
| 10 | 10 |
| 11 Dart_NativeFunction ResolveName(Dart_Handle name, | 11 Dart_NativeFunction ResolveName(Dart_Handle name, |
| 12 int argc, | 12 int argc, |
| 13 bool* auto_setup_scope); | 13 bool* auto_setup_scope); |
| 14 | 14 |
| 15 | 15 |
| 16 DART_EXPORT Dart_Handle sample_extension_Init(Dart_Handle parent_library) { | 16 DART_EXPORT Dart_Handle sample_extension_Init(Dart_Handle parent_library) { |
| 17 if (Dart_IsError(parent_library)) { | 17 if (Dart_IsError(parent_library)) { |
| 18 return parent_library; | 18 return parent_library; |
| 19 } | 19 } |
| 20 | 20 |
| 21 Dart_Handle result_code = Dart_SetNativeResolver(parent_library, ResolveName); | 21 Dart_Handle result_code = |
| 22 Dart_SetNativeResolver(parent_library, ResolveName, NULL); |
| 22 if (Dart_IsError(result_code)) { | 23 if (Dart_IsError(result_code)) { |
| 23 return result_code; | 24 return result_code; |
| 24 } | 25 } |
| 25 | 26 |
| 26 return Dart_Null(); | 27 return Dart_Null(); |
| 27 } | 28 } |
| 28 | 29 |
| 29 | 30 |
| 30 Dart_Handle HandleError(Dart_Handle handle) { | 31 Dart_Handle HandleError(Dart_Handle handle) { |
| 31 if (Dart_IsError(handle)) { | 32 if (Dart_IsError(handle)) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (strcmp(no_scope_function_list[i].name, cname) == 0) { | 179 if (strcmp(no_scope_function_list[i].name, cname) == 0) { |
| 179 *auto_setup_scope = false; | 180 *auto_setup_scope = false; |
| 180 result = no_scope_function_list[i].function; | 181 result = no_scope_function_list[i].function; |
| 181 break; | 182 break; |
| 182 } | 183 } |
| 183 } | 184 } |
| 184 | 185 |
| 185 Dart_ExitScope(); | 186 Dart_ExitScope(); |
| 186 return result; | 187 return result; |
| 187 } | 188 } |
| OLD | NEW |