-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: save a reference to intrinsic constructs #12981
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,3 +278,14 @@ promisify.custom = kCustomPromisifiedSymbol; | |
|
||
exports.promisify = promisify; | ||
exports.customPromisifyArgs = kCustomPromisifyArgsSymbol; | ||
|
||
exports.intrinsic = { | ||
FunctionApply: Function.prototype.apply, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly I just realized that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll be opening a pr to fix up the promisify export, btw |
||
FunctionCall: Function.prototype.call, | ||
ObjectAssign: Object.assign, | ||
ObjectSetPrototypeOf: Object.setPrototypeOf, | ||
Object: Object, | ||
Array: Array, | ||
ObjectPrototype: Object.assign({}, Object.prototype), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather save the prototype methods individually, and set ObjectPrototype to the initial |
||
ArrayPrototype: Object.assign({}, Array.prototype) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized: it's impossible to actually save a pristine and usable
Function.prototype.apply
method in JS, since one can just changeFunction.prototype.apply.call
andFunction.prototype.apply.apply
… That's probably why V8 Extras supply anuncurryThis()
function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reflect.apply is the correct answer to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right.