spec.functionName transformer: hasBinding(name) returns true for built-in globals, so we attempt to rename the binding but it doesn't exist so exits early, add a check that doesn't perform the renaming and instead uses the wrapper - fixes #1598
This commit is contained in:
parent
52a2e3e17c
commit
7dbde208ef
@ -20,7 +20,7 @@ var visitor = {
|
||||
|
||||
var wrap = function (state, method, id, scope) {
|
||||
if (state.selfReference) {
|
||||
if (scope.hasBinding(id.name)) {
|
||||
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
|
||||
// we can just munge the local binding
|
||||
scope.rename(id.name);
|
||||
} else {
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
var test = {
|
||||
setInterval: function(fn, ms) {
|
||||
setInterval(fn, ms);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var test = {
|
||||
setInterval: (function (_setInterval) {
|
||||
function setInterval(_x, _x2) {
|
||||
return _setInterval.apply(this, arguments);
|
||||
}
|
||||
|
||||
setInterval.toString = function () {
|
||||
return _setInterval.toString();
|
||||
};
|
||||
|
||||
return setInterval;
|
||||
})(function (fn, ms) {
|
||||
setInterval(fn, ms);
|
||||
})
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user