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

Conversation

@nking07049925
Copy link

@nking07049925nking07049925 commentedJul 7, 2025
edited
Loading

Resolves#7955

Changes:

WebGLShaderGenerator.js

  • Wraps function source string in round brackets to prevent issues withacorn parsing top level function statements

Unit Tests

  • Adds a unit test top5.Shader for an anonymous function being passed into the shader

Screenshots of the change

Example from the issue running locally with no errors
image

PR Checklist

  • npm run lint passes
  • Unit tests are included / updated

@welcome
Copy link

welcomebot commentedJul 7, 2025

🎉 Thanks for opening this pull request! For guidance on contributing, check out ourcontributor guidelines and otherresources for contributors!
🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure!
🌸 Once your PR is merged, be sure toadd yourself to thelist of contributors on the readme page !

Thank You!

Copy link
Contributor

@davepagurekdavepagurek left a 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()})`;
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
@davepagurekdavepagurek merged commite4ad5ee intoprocessing:dev-2.0Jul 9, 2025
2 checks passed
@davepagurek
Copy link
Contributor

@all-contributors please add@nking07049925 for code

nking07049925 reacted with heart emoji

@allcontributors
Copy link
Contributor

@davepagurek

I've put upa pull request to add@nking07049925! 🎉

@nking07049925nking07049925 deleted the 7955_strands_AnonymousFunctionCallbackFix branchJuly 11, 2025 17:53
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@davepagurekdavepagurekdavepagurek left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@nking07049925@davepagurek

[8]ページ先頭

©2009-2025 Movatter.jp