// 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 Execution of a for statement of the form for (var v = e0; c; e) s
/// proceeds as follows:
/// If c is empty then let c' be true otherwise let c' be c.
/// First the variable declaration statement var v = e0 is executed. Then:
/// 1. If this is the first iteration of the for loop, let v' be v. Otherwise,
///    let v' be the variable v'' created in the previous execution of step 4.
/// 2. The expression [v'/v]c is evaluated and subjected to boolean conversion.
///    If the result is false, the for loop completes. Otherwise, execution
///    continues at step 3.
/// 3. The statement [v'/v]s is executed.
/// 4. Let v'' be a fresh variable. v'' is bound to the value of v'.
/// 5. The expression [v''/v]e is evaluated, and the process recurses at step 1.
/// @description Checks that the variable declaration statement var v = e0 is
/// executed first.
/// @author vasya

import '../../../../Utils/expect.dart';

main() {
  for (var i = 0; i < 1; i++) {
    Expect.equals(0, i);
    break;
  }

  for (var i = true; i = false; i = false) {
    Expect.equals(true, i);
    break;
  }

  for (var i; ; ) {
    Expect.equals(null, i);
    break;
  }
}

