blob: ca7260e43c8d177708e0e32b3da3446e796cba20 [file] [log] [blame]
/*
* Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
* for details. All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
*/
/**
* @assertion Let s1,...,sn be those try statements that are both
* enclosed in sE and that enclose sc, and that have a finally clause. Lastly, let
* fj be the finally clause of sj, 1 <= j <= n. Executing sc first executes f1,...,fn
* in innermost-clause-first order. Then, if sE is a case clause, control is transferred
* to the case clause. Otherwise, sE is necessarily a loop and execution resumes
* after the last statement in the loop body.
* @description Checks that the execution of "continue;" statement transfers
* control to the innermost enclosing loop statement and that all finally
* clauses between them are executed in the innermost-clause-first order.
* @author rodionov
* @reviewer iefremov
*/
import "../../Utils/expect.dart";
main() {
List order = new List();
bool flag = false;
while(!flag) {
switch(1) {
case 1:
case 2:
try {
try {
flag = true;
continue;
Expect.fail("This code shouldn't be executed");
} finally {
order.add(3);
}
} finally {
order.add(2);
}
break;
case 3:
Expect.fail("This code shouldn't be executed");
break;
default:
Expect.fail("This code shouldn't be executed");
break;
}
order.add(1);
}
Expect.listEquals([3, 2], order);
}