invertloop_bug.js 680 B

123456789101112131415161718192021
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. // Triggering invertloop codepath and ensuring the copying of nodes happens correctly.
  6. function foo() {
  7. for (var a = 0; a < 1; ++a) {
  8. for (var b = 0; b < 11; ++b) {
  9. (true());
  10. }
  11. };
  12. };
  13. try {
  14. foo();
  15. } catch(e) {
  16. print(e.message === 'Function expected' ? 'pass' : 'fail');
  17. }