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 "include/dart_mirrors_api.h" | 5 #include "include/dart_mirrors_api.h" |
6 #include "include/dart_tools_api.h" | 6 #include "include/dart_tools_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 "class Test4<A, B> extends Test2<A> {\n" | 2132 "class Test4<A, B> extends Test2<A> {\n" |
2133 "}\n" | 2133 "}\n" |
2134 "class Test5<A, B, C> extends Test4<A, B> {\n" | 2134 "class Test5<A, B, C> extends Test4<A, B> {\n" |
2135 "}\n" | 2135 "}\n" |
2136 "var s = new Set();\n" | 2136 "var s = new Set();\n" |
2137 "var l = new List();\n" | 2137 "var l = new List();\n" |
2138 "int main() {\n" | 2138 "int main() {\n" |
2139 "}\n"; | 2139 "}\n"; |
2140 | 2140 |
2141 Isolate* isolate = Isolate::Current(); | 2141 Isolate* isolate = Isolate::Current(); |
| 2142 Zone* zone = isolate->current_zone(); |
2142 LoadScript(kScriptChars); | 2143 LoadScript(kScriptChars); |
2143 ASSERT(script_lib != NULL); | 2144 ASSERT(script_lib != NULL); |
2144 ASSERT(Dart_IsLibrary(script_lib)); | 2145 ASSERT(Dart_IsLibrary(script_lib)); |
2145 Dart_Handle core_lib = Dart_LookupLibrary(NewString("dart:core")); | 2146 Dart_Handle core_lib = Dart_LookupLibrary(NewString("dart:core")); |
2146 | 2147 |
2147 Dart_Handle Test_name = Dart_NewStringFromCString("Test"); | 2148 Dart_Handle Test_name = Dart_NewStringFromCString("Test"); |
2148 Dart_Handle Test1_name = Dart_NewStringFromCString("Test1"); | 2149 Dart_Handle Test1_name = Dart_NewStringFromCString("Test1"); |
2149 Dart_Handle Test2_name = Dart_NewStringFromCString("Test2"); | 2150 Dart_Handle Test2_name = Dart_NewStringFromCString("Test2"); |
2150 Dart_Handle Test3_name = Dart_NewStringFromCString("Test3"); | 2151 Dart_Handle Test3_name = Dart_NewStringFromCString("Test3"); |
2151 Dart_Handle Test4_name = Dart_NewStringFromCString("Test4"); | 2152 Dart_Handle Test4_name = Dart_NewStringFromCString("Test4"); |
(...skipping 30 matching lines...) Expand all Loading... |
2182 Dart_Handle Test5_int_type = Dart_GetType(script_lib, | 2183 Dart_Handle Test5_int_type = Dart_GetType(script_lib, |
2183 Test5_name, | 2184 Test5_name, |
2184 3, | 2185 3, |
2185 &type_args); | 2186 &type_args); |
2186 { | 2187 { |
2187 Dart_Handle super_type = Dart_GetSupertype(object_type); | 2188 Dart_Handle super_type = Dart_GetSupertype(object_type); |
2188 EXPECT(super_type == Dart_Null()); | 2189 EXPECT(super_type == Dart_Null()); |
2189 } | 2190 } |
2190 { | 2191 { |
2191 Dart_Handle super_type = Dart_GetSupertype(Test1_type); | 2192 Dart_Handle super_type = Dart_GetSupertype(Test1_type); |
2192 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test_type); | 2193 const Type& expected_type = Api::UnwrapTypeHandle(zone, Test_type); |
2193 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type); | 2194 const Type& actual_type = Api::UnwrapTypeHandle(zone, super_type); |
2194 EXPECT(expected_type.raw() == actual_type.raw()); | 2195 EXPECT(expected_type.raw() == actual_type.raw()); |
2195 } | 2196 } |
2196 { | 2197 { |
2197 Dart_Handle super_type = Dart_GetSupertype(Test3_type); | 2198 Dart_Handle super_type = Dart_GetSupertype(Test3_type); |
2198 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test2_int_type); | 2199 const Type& expected_type = Api::UnwrapTypeHandle(zone, Test2_int_type); |
2199 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type); | 2200 const Type& actual_type = Api::UnwrapTypeHandle(zone, super_type); |
2200 EXPECT(expected_type.raw() == actual_type.raw()); | 2201 EXPECT(expected_type.raw() == actual_type.raw()); |
2201 } | 2202 } |
2202 { | 2203 { |
2203 Dart_Handle super_type = Dart_GetSupertype(Test4_int_type); | 2204 Dart_Handle super_type = Dart_GetSupertype(Test4_int_type); |
2204 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test2_int_type); | 2205 const Type& expected_type = Api::UnwrapTypeHandle(zone, Test2_int_type); |
2205 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type); | 2206 const Type& actual_type = Api::UnwrapTypeHandle(zone, super_type); |
2206 EXPECT(expected_type.raw() == actual_type.raw()); | 2207 EXPECT(expected_type.raw() == actual_type.raw()); |
2207 } | 2208 } |
2208 { | 2209 { |
2209 Dart_Handle super_type = Dart_GetSupertype(Test5_int_type); | 2210 Dart_Handle super_type = Dart_GetSupertype(Test5_int_type); |
2210 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test4_int_type); | 2211 const Type& expected_type = Api::UnwrapTypeHandle(zone, Test4_int_type); |
2211 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type); | 2212 const Type& actual_type = Api::UnwrapTypeHandle(zone, super_type); |
2212 EXPECT(expected_type.raw() == actual_type.raw()); | 2213 EXPECT(expected_type.raw() == actual_type.raw()); |
2213 } | 2214 } |
2214 { | 2215 { |
2215 Dart_Handle set_type = Dart_GetType(core_lib, set_name, 0, NULL); | 2216 Dart_Handle set_type = Dart_GetType(core_lib, set_name, 0, NULL); |
2216 Dart_Handle super_type = Dart_GetSupertype(set_type); | 2217 Dart_Handle super_type = Dart_GetSupertype(set_type); |
2217 Dart_Handle iterable_type = Dart_GetType(core_lib, iterable_name, 0, NULL); | 2218 Dart_Handle iterable_type = Dart_GetType(core_lib, iterable_name, 0, NULL); |
2218 const Type& expected_type = Api::UnwrapTypeHandle(isolate, iterable_type); | 2219 const Type& expected_type = Api::UnwrapTypeHandle(zone, iterable_type); |
2219 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type); | 2220 const Type& actual_type = Api::UnwrapTypeHandle(zone, super_type); |
2220 EXPECT(expected_type.raw() == actual_type.raw()); | 2221 EXPECT(expected_type.raw() == actual_type.raw()); |
2221 } | 2222 } |
2222 { | 2223 { |
2223 Dart_Handle list_type = Dart_GetType(core_lib, list_name, 0, NULL); | 2224 Dart_Handle list_type = Dart_GetType(core_lib, list_name, 0, NULL); |
2224 Dart_Handle super_type = Dart_GetSupertype(list_type); | 2225 Dart_Handle super_type = Dart_GetSupertype(list_type); |
2225 EXPECT(!Dart_IsError(super_type)); | 2226 EXPECT(!Dart_IsError(super_type)); |
2226 super_type = Dart_GetSupertype(super_type); | 2227 super_type = Dart_GetSupertype(super_type); |
2227 EXPECT(!Dart_IsError(super_type)); | 2228 EXPECT(!Dart_IsError(super_type)); |
2228 EXPECT(super_type == Dart_Null()); | 2229 EXPECT(super_type == Dart_Null()); |
2229 } | 2230 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," | 2316 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," |
2316 " null, 4, 13, 3, 14, 10," | 2317 " null, 4, 13, 3, 14, 10," |
2317 " null, 5, 17, 5, 18, 9, 19, 12," | 2318 " null, 5, 17, 5, 18, 9, 19, 12," |
2318 " null, 6, 21, 1," | 2319 " null, 6, 21, 1," |
2319 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," | 2320 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," |
2320 " null, 9, 29, 1]", | 2321 " null, 9, 29, 1]", |
2321 tokens_cstr); | 2322 tokens_cstr); |
2322 } | 2323 } |
2323 | 2324 |
2324 } // namespace dart | 2325 } // namespace dart |
OLD | NEW |