OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 #include "bin/builtin.h" | |
6 | |
7 #include "include/dart_api.h" | |
8 | |
9 void FUNCTION_NAME(Common_IsBuiltinList)(Dart_NativeArguments args) { | |
10 Dart_EnterScope(); | |
11 Dart_Handle list = Dart_GetNativeArgument(args, 0); | |
12 Dart_Handle list_class = Dart_InstanceGetClass(list); | |
13 ASSERT(!Dart_IsError(list_class)); | |
14 Dart_Handle coreimpl_lib = | |
15 Dart_LookupLibrary(Dart_NewString("dart:coreimpl")); | |
Søren Gjesse
2012/09/27 12:18:20
Do we want to keep these strings in persistent han
Mads Ager (google)
2012/09/27 12:34:26
Potentially. We don't do that with any other strin
| |
16 ASSERT(!Dart_IsError(coreimpl_lib)); | |
17 Dart_Handle object_array_class = | |
18 Dart_GetClass(coreimpl_lib, Dart_NewString("_ObjectArray")); | |
19 ASSERT(!Dart_IsError(object_array_class)); | |
20 Dart_Handle immutable_array_class = | |
21 Dart_GetClass(coreimpl_lib, Dart_NewString("_ImmutableArray")); | |
22 ASSERT(!Dart_IsError(immutable_array_class)); | |
23 // TODO(5474): We should be able to allow _GrowableObjectArrays here as well. | |
24 bool builtin_array = (Dart_IdentityEquals(list_class, object_array_class) || | |
25 Dart_IdentityEquals(list_class, immutable_array_class)); | |
26 Dart_SetReturnValue(args, Dart_NewBoolean(builtin_array)); | |
27 Dart_ExitScope(); | |
28 } | |
OLD | NEW |