Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.7k
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
Fix inline anonymous functions causing a parsing error in p5.strands callbacks#7956
Uh oh!
There was an error while loading.Please reload this page.
Conversation
🎉 Thanks for opening this pull request! For guidance on contributing, check out ourcontributor guidelines and otherresources for contributors! Thank You! |
davepagurek left a comment
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.
Thanks for adding this, and the test as well! Just one minor comment about leaving some context for the change behind.
| letgeneratorFunction; | ||
| if(options.parser){ | ||
| constsourceString=shaderModifier.toString() | ||
| constsourceString=`(${shaderModifier.toString()})`; |
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 mind adding a comment here to explain to other contributors why the brackets are necessary?
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.
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 parsingThere 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.
looks great, thanks!
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.
Nice! I will be able to make a commit later today
e4ad5ee intoprocessing:dev-2.0Uh oh!
There was an error while loading.Please reload this page.
davepagurek commentedJul 9, 2025
@all-contributors please add@nking07049925 for code |
I've put upa pull request to add@nking07049925! 🎉 |
Uh oh!
There was an error while loading.Please reload this page.
Resolves#7955
Changes:
WebGL
ShaderGenerator.jsUnit Tests
p5.Shaderfor an anonymous function being passed into the shaderScreenshots of the change
Example from the issue running locally with no errors

PR Checklist
npm run lintpasses