better arguments aliasing for arrow functions, add it to block binding - fixes #52
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
function outer() {
|
||||
function one() {
|
||||
var inner = () => arguments;
|
||||
return [].slice.call(inner());
|
||||
}
|
||||
console.log(outer(1, 2));
|
||||
one(1, 2);
|
||||
|
||||
function outer() {
|
||||
function two() {
|
||||
var inner = () => arguments;
|
||||
|
||||
var another = function () {
|
||||
@@ -13,4 +13,22 @@ function outer() {
|
||||
|
||||
return [].slice.call(inner());
|
||||
}
|
||||
console.log(outer(1, 2));
|
||||
two(1, 2);
|
||||
|
||||
function three() {
|
||||
var fn = () => arguments[0] + "bar";
|
||||
return fn();
|
||||
}
|
||||
three("foo");
|
||||
|
||||
function four() {
|
||||
var fn = () => arguments[0].foo + "bar";
|
||||
return fn();
|
||||
}
|
||||
four({ foo: "foo" });
|
||||
|
||||
function five(obj) {
|
||||
var fn = () => obj.arguments[0].foo + "bar";
|
||||
return fn();
|
||||
}
|
||||
five({ arguments: ["foo"] });
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
function outer() {
|
||||
function one() {
|
||||
var _arguments = arguments;
|
||||
var inner = function () { return _arguments; };
|
||||
return [].slice.call(inner());
|
||||
}
|
||||
console.log(outer(1, 2));
|
||||
one(1, 2);
|
||||
|
||||
function outer() {
|
||||
function two() {
|
||||
var _arguments2 = arguments;
|
||||
var inner = function () { return _arguments2; };
|
||||
|
||||
@@ -16,4 +16,30 @@ function outer() {
|
||||
|
||||
return [].slice.call(inner());
|
||||
}
|
||||
console.log(outer(1, 2));
|
||||
two(1, 2);
|
||||
|
||||
function three() {
|
||||
var _arguments4 = arguments;
|
||||
var fn = function () {
|
||||
return _arguments4[0] + "bar";
|
||||
};
|
||||
return fn();
|
||||
}
|
||||
three("foo");
|
||||
|
||||
function four() {
|
||||
var _arguments5 = arguments;
|
||||
var fn = function () {
|
||||
return _arguments5[0].foo + "bar";
|
||||
};
|
||||
return fn();
|
||||
}
|
||||
four({ foo: "foo" });
|
||||
|
||||
function five(obj) {
|
||||
var fn = function () {
|
||||
return obj.arguments[0].foo + "bar";
|
||||
};
|
||||
return fn();
|
||||
}
|
||||
five({ arguments: ["foo"] });
|
||||
|
||||
6
test/fixtures/syntax/block-binding/arguments/actual.js
vendored
Normal file
6
test/fixtures/syntax/block-binding/arguments/actual.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
(function () {
|
||||
if (true) {
|
||||
let a = arguments[0];
|
||||
console.log(a);
|
||||
}
|
||||
})(1);
|
||||
9
test/fixtures/syntax/block-binding/arguments/expected.js
vendored
Normal file
9
test/fixtures/syntax/block-binding/arguments/expected.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
(function () {
|
||||
if (true) {
|
||||
var _arguments = arguments;
|
||||
(function () {
|
||||
var a = _arguments[0];
|
||||
console.log(a);
|
||||
})();
|
||||
}
|
||||
})(1);
|
||||
Reference in New Issue
Block a user