diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2019-11-29 18:08:07 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2019-12-04 12:17:34 +0000 |
commit | db73deb3bdede559bb7639bf3d0a07a32a17c6d8 (patch) | |
tree | ce68307cb3f43578e9713976712412d603079d5e /test/language/expressions/coalesce/tco-pos-undefined.js | |
parent | 6b0c42c63c2492bd0a7a96d3179d122b5f71793f (diff) | |
download | qtdeclarative-testsuites-db73deb3bdede559bb7639bf3d0a07a32a17c6d8.tar.gz |
test/language/expressions: Add nullish coalescing tests
Copies a few tests for nullish coalescing straight from the newest
test262 master branch so that we can test
https://codereview.qt-project.org/c/qt/qtdeclarative/+/283241 .
Change-Id: I312e96c1e2934d2933421371d58bfce670f244ae
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'test/language/expressions/coalesce/tco-pos-undefined.js')
-rw-r--r-- | test/language/expressions/coalesce/tco-pos-undefined.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/language/expressions/coalesce/tco-pos-undefined.js b/test/language/expressions/coalesce/tco-pos-undefined.js new file mode 100644 index 000000000..0065123eb --- /dev/null +++ b/test/language/expressions/coalesce/tco-pos-undefined.js @@ -0,0 +1,26 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +info: | + Expression Rules + + CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression + + 1. Return HasCallInTailPosition of BitwiseORExpression with argument call. +flags: [onlyStrict] +features: [tail-call-optimization, coalesce-expression] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return undefined ?? f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); |