-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
lib: save a reference to intrinsic constructs #12981
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
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, | ||
|
Member
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
Contributor
Author
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.
Member
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), | ||
|
Member
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) | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.
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.applymethod in JS, since one can just changeFunction.prototype.apply.callandFunction.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.