-
Notifications
You must be signed in to change notification settings - Fork 6
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
Get rid of unnecessary grouping operators #6
Conversation
Hey @axion014. Thanks for this and your other commits. I just updated the repo to include tests. Do you suppose you could add a test in Feel free to add simpler .glsl files to the test directory that helps you test your new code. Also add some assertions that validate that no edge-cases or gotchas arise. |
index.js
Outdated
// remove unnecessary grouping operators | ||
if(is_unnecessary_group(node)) return | ||
|
||
if(node.parent) for(var current = node.parent; current.parent; current = current.parent) { |
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.
For stylistic/readability purposes, can you give this if
statement braces, and encapsulate the for
loop within it?
I just found it tricky to get right. For a minifier I would want it to recognize when a operator is commutative. |
I updated the tests here as well to be more readable + succinct |
Btw, does |
# Conflicts: # tap-snapshots/test-basic.js-TAP.test.js # test/basic.js
It doesn't - |
# Conflicts: # index.js # tap-snapshots/test-basic.js-TAP.test.js # test/basic.js
Duh! |
Thanks for your time on maintaining this repository. You appear to be going even further, eh? |
Closes #5.