Provide placeholders for proper function length.

This commit is contained in:
Ingvar Stepanyan 2015-02-07 14:26:03 +02:00
parent 5b2216b348
commit b53b41cef3
8 changed files with 19 additions and 11 deletions

View File

@ -210,6 +210,4 @@ exports.FunctionExpression = function (node, parent, scope) {
]), shouldContinueId),
t.returnStatement(resultId)
]);
node.params = [];
};

View File

@ -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

View File

@ -1,6 +1,6 @@
"use strict";
(function f() {
(function f(n) {
var _arguments = arguments,
_this = this,
_shouldContinue,

View File

@ -1,6 +1,6 @@
"use strict";
(function f() {
(function f(n) {
var _arguments = arguments,
_this = this,
_shouldContinue,

View File

@ -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";
}

View 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");

View File

@ -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";
}

View File

@ -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,