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 3291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3302 " int y = ......;\n" | 3302 " int y = ......;\n" |
3303 "}\n" | 3303 "}\n" |
3304 "Foo value;\n" | 3304 "Foo value;\n" |
3305 "main() {\n" | 3305 "main() {\n" |
3306 " return '${value.y == null}';" | 3306 " return '${value.y == null}';" |
3307 "}\n"; | 3307 "}\n"; |
3308 | 3308 |
3309 // The reload fails because the initializing expression is parsed at | 3309 // The reload fails because the initializing expression is parsed at |
3310 // class finalization time. | 3310 // class finalization time. |
3311 lib = TestCase::ReloadTestScript(kReloadScript); | 3311 lib = TestCase::ReloadTestScript(kReloadScript); |
3312 EXPECT_ERROR(lib, "......"); | 3312 EXPECT_ERROR(lib, "..."); |
ahe
2017/07/14 11:45:07
This relied on having a source snippet. For legacy
| |
3313 } | 3313 } |
3314 | 3314 |
3315 | 3315 |
3316 // When an initializer expression has a syntax error, we detect it at reload | 3316 // When an initializer expression has a syntax error, we detect it at reload |
3317 // time. | 3317 // time. |
3318 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError2) { | 3318 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError2) { |
3319 const char* kScript = | 3319 const char* kScript = |
3320 "class Foo {\n" | 3320 "class Foo {\n" |
3321 " Foo() { /* default constructor */ }\n" | 3321 " Foo() { /* default constructor */ }\n" |
3322 " int x = 4;\n" | 3322 " int x = 4;\n" |
(...skipping 16 matching lines...) Expand all Loading... | |
3339 " int y = ......;\n" | 3339 " int y = ......;\n" |
3340 "}\n" | 3340 "}\n" |
3341 "Foo value;\n" | 3341 "Foo value;\n" |
3342 "main() {\n" | 3342 "main() {\n" |
3343 " return '${value.y == null}';" | 3343 " return '${value.y == null}';" |
3344 "}\n"; | 3344 "}\n"; |
3345 | 3345 |
3346 // The reload fails because the initializing expression is parsed at | 3346 // The reload fails because the initializing expression is parsed at |
3347 // class finalization time. | 3347 // class finalization time. |
3348 lib = TestCase::ReloadTestScript(kReloadScript); | 3348 lib = TestCase::ReloadTestScript(kReloadScript); |
3349 EXPECT_ERROR(lib, "......"); | 3349 EXPECT_ERROR(lib, "..."); |
3350 } | 3350 } |
3351 | 3351 |
3352 | 3352 |
3353 // When an initializer expression has a syntax error, we detect it at reload | 3353 // When an initializer expression has a syntax error, we detect it at reload |
3354 // time. | 3354 // time. |
3355 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError3) { | 3355 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError3) { |
3356 const char* kScript = | 3356 const char* kScript = |
3357 "class Foo {\n" | 3357 "class Foo {\n" |
3358 " Foo() { /* default constructor */ }\n" | 3358 " Foo() { /* default constructor */ }\n" |
3359 " int x = 4;\n" | 3359 " int x = 4;\n" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3497 "}\n"; | 3497 "}\n"; |
3498 | 3498 |
3499 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); | 3499 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); |
3500 EXPECT_VALID(result); | 3500 EXPECT_VALID(result); |
3501 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main")); | 3501 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main")); |
3502 } | 3502 } |
3503 | 3503 |
3504 #endif // !PRODUCT | 3504 #endif // !PRODUCT |
3505 | 3505 |
3506 } // namespace dart | 3506 } // namespace dart |
OLD | NEW |