-
Notifications
You must be signed in to change notification settings - Fork 3.5k
remove evil new Function in $createNamedFunction #17267
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Sadly we don't yet support the spread operator in output code. Hopefully it should be available soon as we are moving towards allowing all of ES6. See #11984 for more info on ES6 support.
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.
Do you know why this #else block exists? Why don't we just always use the simpler
DYNAMIC_EXECUTION == 0form above?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 have encountered it for v8 on Cloudflare workers when it was trying to tell me the modularized Module has no default export.
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.
But do you know why we can't just completely remove the
if/elsehere? (and just use what is in the of block now in all cases?)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.
Noope!
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 could, but it would be a favor not something I need (someone else had a reason for it, even with environment=web). I believe a better PR would be to map an array of arguments instead of[ using] the spread operator. I can do that and achieve-absolutely unlimited arguments within the week! Type Y to confirm.
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'm not quite sure what you mean by "map an array of arguments" or "absolutely unlimited arguments". Perhaps the best thing to do would be upload a proposed change.
In the mean time I might look into removing the if/else as a intermediate step.
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.
Actually it looks like closure does a good job of transpiling these https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#computed_property_names to ES5 so I think your solution is good.
Any it works for DYNAMIC_EXECUTION so if you want to update this PR to replace the whole if/else that would work.. or I'm happy to do that too.
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.
wow
a week flys by when you are having fun and almost embarrassed
does this other pull request work? should I truly not be editing this one? I haven't done these before
{ [name]: function(arguments){ var context = {}; for (var prop in body) { context[prop] = body[prop]; }; return body.apply(context,arguments); } }[name];(rebase/new pull request)For readers,
export {Module as default}, maybe makeENVIRONMENT_IS_WORKER = false;with your rollup build dist (to cloudflare's v8 workers); however, I am working throughaborted - (a)sync fetching of the wasm failed.. please hold if related.. (update 14d: no need to alteremccbuild script outfile for v8 cloudflare service workers, the js glue code was used by them to read.watinstead of.wasmbecause the VSCode IDE does not allow you to see.wasmas text and the WebAssembly extension just translates the binarily encoded bytecode to.wat. So, now it is recognized by the abstract sw by js glue code andwrangler.toml\wasm_modules={ENVMODULE1="./a.out.wasm"}, and actually may need to edit some of the glue js outfile).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.
You can edit existing PRs, or open new ones. Its up to you.