Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1463)

Side by Side Diff: tests/kernel/unsorted/finally_contexts_test.dart

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'expect.dart';
6
7 // Test that the context depth is correct in the presence of control flow,
8 // specifically branching and joining in the presence of break. The
9 // implementation uses the context depth after the else block of an if/then/else
10 // as the context depth at the join point. This test has an extra context
11 // allocated in the (untaken) else branch so it tests that compiling the
12 // (untaken) break properly tracks the context depth.
13
14 test(list) {
15 // The loops force creation of a new context, otherwise context allocated
16 // variables might be hoisted to an outer context.
17 do {
18 if (list.length > 1) {
19 do {
20 var sum = 0;
21 addem() {
22 for (var x in list) sum += x;
23 }
24 addem();
25 Expect.isTrue(sum == 15);
26 L: if (sum != 15) {
27 // Unreachable.
28 do {
29 var product = 1;
30 multiplyem() {
31 for (var x in list) product *= x;
32 }
33 multiplyem();
34 Expect.isTrue(false);
35 break L;
36 } while (false);
37 }
38 } while (false);
39 }
40 } while (false);
41 Expect.isTrue(list.length == 5);
42 }
43
44
45 main() {
46 test([1, 2, 3, 4, 5]);
47 }
OLDNEW
« no previous file with comments | « tests/kernel/unsorted/field_dispatcher_test.dart ('k') | tests/kernel/unsorted/for_in_loop_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698