Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix inline anonymous functions causing a parsing error in p5.strands callbacks#7956

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Add comment with an explanation
  • Loading branch information
@nking07049925
nking07049925 committedJul 9, 2025
commitdcc31b798f798fec7717da57a6cf228bc0f43a54
2 changes: 2 additions & 0 deletionssrc/webgl/ShaderGenerator.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,8 @@ function shadergenerator(p5, fn) {
if (shaderModifier instanceof Function) {
let generatorFunction;
if (options.parser) {
// #7955 Wrap function declaration code in brackets so anonymous functions are not top level statements, which causes an error in acorn when parsing
// https://github.com/acornjs/acorn/issues/1385
const sourceString = `(${shaderModifier.toString()})`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do you mind adding a comment here to explain to other contributors why the brackets are necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Would something like this work?

// #7955 Wrap function declaration code in brackets so anonymous functions are not top level statements, which causes an error in acorn when parsing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

looks great, thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice! I will be able to make a commit later today

davepagurek reacted with heart emoji
const ast = parse(sourceString, {
ecmaVersion: 2021,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp