| 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 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
| 7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/json.h" | 10 #include "platform/json.h" |
| (...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 "}\n" | 2803 "}\n" |
| 2804 "\n" | 2804 "\n" |
| 2805 "abstract class MyInterface0 {\n" | 2805 "abstract class MyInterface0 {\n" |
| 2806 "}\n" | 2806 "}\n" |
| 2807 "\n" | 2807 "\n" |
| 2808 "abstract class MyInterface1 implements MyInterface0 {\n" | 2808 "abstract class MyInterface1 implements MyInterface0 {\n" |
| 2809 "}\n" | 2809 "}\n" |
| 2810 "MyClass0 getMyClass0() { return new MyClass0(); }\n" | 2810 "MyClass0 getMyClass0() { return new MyClass0(); }\n" |
| 2811 "MyClass1 getMyClass1() { return new MyClass1(); }\n" | 2811 "MyClass1 getMyClass1() { return new MyClass1(); }\n" |
| 2812 "MyClass2 getMyClass2() { return new MyClass2(); }\n" | 2812 "MyClass2 getMyClass2() { return new MyClass2(); }\n" |
| 2813 "MyClass0 getMyClass0Type() { return new MyClass0().runtimeType; }\n" | 2813 "Type getMyClass0Type() { return new MyClass0().runtimeType; }\n" |
| 2814 "MyClass1 getMyClass1Type() { return new MyClass1().runtimeType; }\n" | 2814 "Type getMyClass1Type() { return new MyClass1().runtimeType; }\n" |
| 2815 "MyClass2 getMyClass2Type() { return new MyClass2().runtimeType; }\n"; | 2815 "Type getMyClass2Type() { return new MyClass2().runtimeType; }\n"; |
| 2816 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 2816 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 2817 bool instanceof = false; | 2817 bool instanceof = false; |
| 2818 | 2818 |
| 2819 // First get the type objects of these non parameterized types. | 2819 // First get the type objects of these non parameterized types. |
| 2820 Dart_Handle type0 = Dart_GetType(lib, NewString("MyClass0"), 0, NULL); | 2820 Dart_Handle type0 = Dart_GetType(lib, NewString("MyClass0"), 0, NULL); |
| 2821 EXPECT_VALID(type0); | 2821 EXPECT_VALID(type0); |
| 2822 Dart_Handle type1 = Dart_GetType(lib, NewString("MyClass1"), 0, NULL); | 2822 Dart_Handle type1 = Dart_GetType(lib, NewString("MyClass1"), 0, NULL); |
| 2823 EXPECT_VALID(type1); | 2823 EXPECT_VALID(type1); |
| 2824 Dart_Handle type2 = Dart_GetType(lib, NewString("MyClass2"), 0, NULL); | 2824 Dart_Handle type2 = Dart_GetType(lib, NewString("MyClass2"), 0, NULL); |
| 2825 EXPECT_VALID(type2); | 2825 EXPECT_VALID(type2); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 TEST_CASE(TypeGetParamterizedTypes) { | 2886 TEST_CASE(TypeGetParamterizedTypes) { |
| 2887 const char* kScriptChars = | 2887 const char* kScriptChars = |
| 2888 "class MyClass0<A, B> {\n" | 2888 "class MyClass0<A, B> {\n" |
| 2889 "}\n" | 2889 "}\n" |
| 2890 "\n" | 2890 "\n" |
| 2891 "class MyClass1<A, C> {\n" | 2891 "class MyClass1<A, C> {\n" |
| 2892 "}\n" | 2892 "}\n" |
| 2893 "MyClass0 getMyClass0() {\n" | 2893 "MyClass0 getMyClass0() {\n" |
| 2894 " return new MyClass0<int, double>();\n" | 2894 " return new MyClass0<int, double>();\n" |
| 2895 "}\n" | 2895 "}\n" |
| 2896 "MyClass0 getMyClass0Type() {\n" | 2896 "Type getMyClass0Type() {\n" |
| 2897 " return new MyClass0<int, double>().runtimeType;\n" | 2897 " return new MyClass0<int, double>().runtimeType;\n" |
| 2898 "}\n" | 2898 "}\n" |
| 2899 "MyClass1 getMyClass1() {\n" | 2899 "MyClass1 getMyClass1() {\n" |
| 2900 " return new MyClass1<List<int>, List>();\n" | 2900 " return new MyClass1<List<int>, List>();\n" |
| 2901 "}\n" | 2901 "}\n" |
| 2902 "MyClass1 getMyClass1Type() {\n" | 2902 "Type getMyClass1Type() {\n" |
| 2903 " return new MyClass1<List<int>, List>().runtimeType;\n" | 2903 " return new MyClass1<List<int>, List>().runtimeType;\n" |
| 2904 "}\n" | 2904 "}\n" |
| 2905 "MyClass0 getMyClass0_1() {\n" | 2905 "MyClass0 getMyClass0_1() {\n" |
| 2906 " return new MyClass0<double, int>();\n" | 2906 " return new MyClass0<double, int>();\n" |
| 2907 "}\n" | 2907 "}\n" |
| 2908 "MyClass0 getMyClass0_1Type() {\n" | 2908 "Type getMyClass0_1Type() {\n" |
| 2909 " return new MyClass0<double, int>().runtimeType;\n" | 2909 " return new MyClass0<double, int>().runtimeType;\n" |
| 2910 "}\n" | 2910 "}\n" |
| 2911 "MyClass1 getMyClass1_1() {\n" | 2911 "MyClass1 getMyClass1_1() {\n" |
| 2912 " return new MyClass1<List<int>, List<double>>();\n" | 2912 " return new MyClass1<List<int>, List<double>>();\n" |
| 2913 "}\n" | 2913 "}\n" |
| 2914 "MyClass1 getMyClass1_1Type() {\n" | 2914 "Type getMyClass1_1Type() {\n" |
| 2915 " return new MyClass1<List<int>, List<double>>().runtimeType;\n" | 2915 " return new MyClass1<List<int>, List<double>>().runtimeType;\n" |
| 2916 "}\n"; | 2916 "}\n"; |
| 2917 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 2917 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 2918 bool instanceof = false; | 2918 bool instanceof = false; |
| 2919 | 2919 |
| 2920 // First get type objects of some of the basic types used in the test. | 2920 // First get type objects of some of the basic types used in the test. |
| 2921 Dart_Handle int_type = Dart_GetType(lib, NewString("int"), 0, NULL); | 2921 Dart_Handle int_type = Dart_GetType(lib, NewString("int"), 0, NULL); |
| 2922 EXPECT_VALID(int_type); | 2922 EXPECT_VALID(int_type); |
| 2923 Dart_Handle double_type = Dart_GetType(lib, NewString("double"), 0, NULL); | 2923 Dart_Handle double_type = Dart_GetType(lib, NewString("double"), 0, NULL); |
| 2924 EXPECT_VALID(double_type); | 2924 EXPECT_VALID(double_type); |
| (...skipping 5174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8099 NewString("main"), | 8099 NewString("main"), |
| 8100 0, | 8100 0, |
| 8101 NULL); | 8101 NULL); |
| 8102 int64_t value = 0; | 8102 int64_t value = 0; |
| 8103 result = Dart_IntegerToInt64(result, &value); | 8103 result = Dart_IntegerToInt64(result, &value); |
| 8104 EXPECT_VALID(result); | 8104 EXPECT_VALID(result); |
| 8105 EXPECT_EQ(8, value); | 8105 EXPECT_EQ(8, value); |
| 8106 } | 8106 } |
| 8107 | 8107 |
| 8108 } // namespace dart | 8108 } // namespace dart |
| OLD | NEW |