blob: 726eed839c2356ba62110d0ebdd3c199536392f1 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --strong-mode
6
7"use strong";
8
9function foo(param, fooCount, barCount) {
10 if (param === 0)
11 return {'foo': fooCount, 'bar': barCount};
12 return bar(param - 1, fooCount + 1, barCount);
13}
14
15function bar(param, fooCount, barCount) {
16 if (param === 0)
17 return {'foo': fooCount, 'bar': barCount};
18 return foo(param - 1, fooCount, barCount + 1);
19}
20
21(function TestMutuallyRecursiveFunctions() {
22 let obj = foo(10, 0, 0);
23 assertEquals(obj.foo, 5);
24 assertEquals(obj.bar, 5);
25})();