Debian Codegraph @

js/src/tests/test262/language/expressions/coalesce/tco-pos-null-strict.js

raw
1 // |reftest| skip -- tail-call-optimization is not supported
2 'use strict';
3 // Copyright (C) 2019 Leo Balter. All rights reserved.
4 // This code is governed by the BSD license found in the LICENSE file.
5
6 /*---
7 description: Expression is a candidate for tail-call optimization.
8 esid: sec-static-semantics-hascallintailposition
9 info: |
10 Expression Rules
11
12 CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression
13
14 1. Return HasCallInTailPosition of BitwiseORExpression with argument call.
15 flags: [onlyStrict]
16 features: [tail-call-optimization, coalesce-expression]
17 includes: [tcoHelper.js]
18 ---*/
19
20 var callCount = 0;
21 (function f(n) {
22 if (n === 0) {
23 callCount += 1
24 return;
25 }
26 return null ?? f(n - 1);
27 }($MAX_ITERATIONS));
28 assert.sameValue(callCount, 1);
29
30 reportCompare(0, 0);