| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_api.h" | 5 #include "include/dart_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/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 | 1180 |
| 1181 EXPECT_EQ("static", SimpleInvokeStr(lib, "main")); | 1181 EXPECT_EQ("static", SimpleInvokeStr(lib, "main")); |
| 1182 | 1182 |
| 1183 lib = TestCase::GetReloadErrorOrRootLibrary(); | 1183 lib = TestCase::GetReloadErrorOrRootLibrary(); |
| 1184 EXPECT_VALID(lib); | 1184 EXPECT_VALID(lib); |
| 1185 | 1185 |
| 1186 EXPECT_EQ("static", SimpleInvokeStr(lib, "main")); | 1186 EXPECT_EQ("static", SimpleInvokeStr(lib, "main")); |
| 1187 } | 1187 } |
| 1188 | 1188 |
| 1189 | 1189 |
| 1190 TEST_CASE(IsolateReload_PendingSuperCall) { |
| 1191 const char* kScript = |
| 1192 "import 'test:isolate_reload_helper';\n" |
| 1193 "class S {\n" |
| 1194 " foo() => 1;\n" |
| 1195 "}\n" |
| 1196 "class C extends S {\n" |
| 1197 " foo() => 100;\n" |
| 1198 " test() {\n" |
| 1199 " var n = super.foo();\n" |
| 1200 " reloadTest();\n" |
| 1201 " return n + super.foo();\n" |
| 1202 " }\n" |
| 1203 "}\n" |
| 1204 "main() {\n" |
| 1205 " return new C().test();\n" |
| 1206 "}\n"; |
| 1207 |
| 1208 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); |
| 1209 EXPECT_VALID(lib); |
| 1210 |
| 1211 const char* kReloadScript = |
| 1212 "import 'test:isolate_reload_helper';\n" |
| 1213 "class S {\n" |
| 1214 " foo() => 10;\n" |
| 1215 "}\n" |
| 1216 "class C extends S {\n" |
| 1217 " foo() => 100;\n" |
| 1218 " test() {\n" |
| 1219 " var n = super.foo();\n" |
| 1220 " reloadTest();\n" |
| 1221 " return n + super.foo();\n" |
| 1222 " }\n" |
| 1223 "}\n" |
| 1224 "main() {\n" |
| 1225 " return new C().test();\n" |
| 1226 "}\n"; |
| 1227 |
| 1228 TestCase::SetReloadTestScript(kReloadScript); |
| 1229 |
| 1230 EXPECT_EQ(11, SimpleInvoke(lib, "main")); |
| 1231 } |
| 1232 |
| 1233 |
| 1190 TEST_CASE(IsolateReload_EnumEquality) { | 1234 TEST_CASE(IsolateReload_EnumEquality) { |
| 1191 const char* kScript = | 1235 const char* kScript = |
| 1192 "enum Fruit {\n" | 1236 "enum Fruit {\n" |
| 1193 " Apple,\n" | 1237 " Apple,\n" |
| 1194 " Banana,\n" | 1238 " Banana,\n" |
| 1195 "}\n" | 1239 "}\n" |
| 1196 "var x;\n" | 1240 "var x;\n" |
| 1197 "main() {\n" | 1241 "main() {\n" |
| 1198 " x = Fruit.Banana;\n" | 1242 " x = Fruit.Banana;\n" |
| 1199 " return Fruit.Apple.toString();\n" | 1243 " return Fruit.Apple.toString();\n" |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 | 1899 |
| 1856 // ...and the non-core subclass is still named AIterator. | 1900 // ...and the non-core subclass is still named AIterator. |
| 1857 new_subclass = subclasses.At(subclasses.Length() - 1); | 1901 new_subclass = subclasses.At(subclasses.Length() - 1); |
| 1858 name = Class::Cast(new_subclass).Name(); | 1902 name = Class::Cast(new_subclass).Name(); |
| 1859 EXPECT_STREQ("AIterator", name.ToCString()); | 1903 EXPECT_STREQ("AIterator", name.ToCString()); |
| 1860 } | 1904 } |
| 1861 | 1905 |
| 1862 #endif // !PRODUCT | 1906 #endif // !PRODUCT |
| 1863 | 1907 |
| 1864 } // namespace dart | 1908 } // namespace dart |
| OLD | NEW |