always use closure wrap - fixes #864

This commit is contained in:
Sebastian McKenzie
2015-02-22 23:23:34 +11:00
parent 7bff8239a1
commit 52ea7b5f59
2 changed files with 33 additions and 55 deletions

View File

@@ -9,15 +9,19 @@ var obj = {
},
// self reference
h: (function () {
function _getOuter() {
return h;
}
return function h() {
console.log(_getOuter());
h: (function (_h) {
var _hWrapper = function h() {
return _h.apply(this, arguments);
};
})(),
_hWrapper.toString = function () {
return _h.toString();
};
return _hWrapper;
})(function () {
console.log(h);
}),
// no reference
m: function m() {
@@ -31,15 +35,19 @@ var f = function f() {
};
// self reference
var f = (function () {
function _getOuter() {
return f;
}
return function f() {
console.log(_getOuter(), g);
var f = (function (_f) {
var _fWrapper = function f() {
return _f.apply(this, arguments);
};
})();
_fWrapper.toString = function () {
return _f.toString();
};
return _fWrapper;
})(function () {
console.log(f, g);
});
// no reference
var g = function g() {