Set Function.name for funcs in variables and properties as per spec.

Implements correct Function.name for cases like following:
 * `var x = function () { ... }`
 * `var obj = {prop: function () { ... }}`
This commit is contained in:
Ingvar Stepanyan
2015-02-15 23:32:14 +02:00
parent 15dff73cc8
commit 17e65cc772
7 changed files with 135 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
var obj = {
f: function () {
(function f() {
console.log(f);
})();
},
g: function () {
console.log(g);
},
h: function () {
console.log(h);
},
m: function () {
doSmth();
}
};
var f = function () {
console.log(f, g);
};
var g = function () {
doSmth();
};

View File

@@ -0,0 +1,42 @@
"use strict";
var _selfGlobal = typeof global === "undefined" ? self : global;
var obj = {
f: function f() {
(function f() {
console.log(f);
})();
},
g: (function () {
function _getOuter() {
return g;
}
return function g() {
console.log(_getOuter());
};
})(),
h: function h() {
console.log(_selfGlobal.h);
},
m: function m() {
doSmth();
}
};
var f = (function () {
function _getOuter() {
return f;
}
return function f() {
console.log(_getOuter(), g);
};
})();
var g = function g() {
doSmth();
};

View File

@@ -0,0 +1,3 @@
{
"whitelist": ["spec.functionName"]
}