-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix regression with an error on reuse of some built-in methods from a…
…nother realm, close #1133
- Loading branch information
Showing
6 changed files
with
29 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var NATIVE_BIND = require('../internals/function-bind-native'); | ||
|
||
var FunctionPrototype = Function.prototype; | ||
var call = FunctionPrototype.call; | ||
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); | ||
|
||
module.exports = function (fn) { | ||
return NATIVE_BIND ? uncurryThisWithBind(fn) : function () { | ||
return call.apply(fn, arguments); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
var NATIVE_BIND = require('../internals/function-bind-native'); | ||
|
||
var $Function = Function; | ||
var FunctionPrototype = $Function.prototype; | ||
var bind = FunctionPrototype.bind; | ||
var call = FunctionPrototype.call; | ||
var uncurryThis = NATIVE_BIND && bind.bind(call, call); | ||
var classofRaw = require('../internals/classof-raw'); | ||
var uncurryThisRaw = require('../internals/function-uncurry-this-raw'); | ||
|
||
module.exports = function (fn) { | ||
// Nashorn bug: | ||
// https://github.com/zloirock/core-js/issues/1128 | ||
// https://github.com/zloirock/core-js/issues/1130 | ||
return fn instanceof $Function ? NATIVE_BIND ? uncurryThis(fn) : function () { | ||
return call.apply(fn, arguments); | ||
} : undefined; | ||
if (classofRaw(fn) === 'Function') return uncurryThisRaw(fn); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
var $ = require('../internals/export'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var uncurryThisRaw = require('../internals/function-uncurry-this-raw'); | ||
var aCallable = require('../internals/a-callable'); | ||
|
||
// `Function.prototype.unThis` method | ||
// https://github.com/js-choi/proposal-function-un-this | ||
$({ target: 'Function', proto: true, forced: true }, { | ||
unThis: function unThis() { | ||
return uncurryThis(aCallable(this)); | ||
return uncurryThisRaw(aCallable(this)); | ||
} | ||
}); |