Provide placeholders for proper function length.
This commit is contained in:
parent
5b2216b348
commit
b53b41cef3
@ -210,6 +210,4 @@ exports.FunctionExpression = function (node, parent, scope) {
|
||||
]), shouldContinueId),
|
||||
t.returnStatement(resultId)
|
||||
]);
|
||||
|
||||
node.params = [];
|
||||
};
|
||||
|
||||
@ -52,13 +52,13 @@ module.exports = {
|
||||
// needs to be after `es6.blockScoping` due to needing `letReferences` set on blocks
|
||||
"es6.blockScopingTDZ": require("./es6/block-scoping-tdz"),
|
||||
|
||||
"es6.tailCall": require("./es6/tail-call"),
|
||||
|
||||
"es6.parameters.default": require("./es6/parameters.default"),
|
||||
"es6.parameters.rest": require("./es6/parameters.rest"),
|
||||
|
||||
"es6.destructuring": require("./es6/destructuring"),
|
||||
|
||||
"es6.tailCall": require("./es6/tail-call"),
|
||||
|
||||
regenerator: require("./other/regenerator"),
|
||||
|
||||
// needs to be after `regenerator` due to needing `regeneratorRuntime` references
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
(function f() {
|
||||
(function f(n) {
|
||||
var _arguments = arguments,
|
||||
_this = this,
|
||||
_shouldContinue,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
(function f() {
|
||||
(function f(n) {
|
||||
var _arguments = arguments,
|
||||
_this = this,
|
||||
_shouldContinue,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
(function f(n, /* should be undefined after first pass */ m) {
|
||||
(function f(n = getDefaultValue(), /* should be undefined after first pass */ m) {
|
||||
if (n <= 0) {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
9
test/fixtures/transformation/es6-tail-call/recursion/exec.js
vendored
Normal file
9
test/fixtures/transformation/es6-tail-call/recursion/exec.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
var timeLimit = Date.now() + 1000;
|
||||
|
||||
assert.equal((function f(n) {
|
||||
assert.operator(Date.now(), '<', timeLimit, "Timeout");
|
||||
if (n <= 0) {
|
||||
return "foo";
|
||||
}
|
||||
return f(n - 1);
|
||||
})(1e6), "foo");
|
||||
@ -1,13 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
(function f() {
|
||||
(function f(_x, /* should be undefined after first pass */m) {
|
||||
var _arguments = arguments,
|
||||
_this = this,
|
||||
_shouldContinue,
|
||||
_result;
|
||||
do {
|
||||
_shouldContinue = false;
|
||||
_result = (function (n, /* should be undefined after first pass */m) {
|
||||
_result = (function (_x, m) {
|
||||
var n = arguments[0] === undefined ? getDefaultValue() : arguments[0];
|
||||
if (n <= 0) {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
} catch (e) {}
|
||||
})(1000000) === "foo";
|
||||
|
||||
(function f() {
|
||||
(function f(n) {
|
||||
var _arguments = arguments,
|
||||
_this = this,
|
||||
_shouldContinue,
|
||||
@ -43,7 +43,7 @@
|
||||
} finally {}
|
||||
})(1000000) === "foo";
|
||||
|
||||
(function f() {
|
||||
(function f(n) {
|
||||
var _arguments = arguments,
|
||||
_this = this,
|
||||
_shouldContinue,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user