Skip to content

Remove attributes from else-if and else clauses - #344

Open
hippi345 wants to merge 3 commits into
webgpu-tools:mainfrom
hippi345:cursor/drop-else-clause-attributes-2af8
Open

hippi345 wants to merge 3 commits into
webgpu-tools:mainfrom
hippi345:cursor/drop-else-clause-attributes-2af8

Conversation

@hippi345

Copy link
Copy Markdown

WGSL does not allow attributes on else if or else branches. This removes the attributes fields from ElseIfClause and ElseClause in the syntax tree, stops printing them, and updates the wesl visitor and query macros to match. The grammar was already not attaching them.

Adds the if_statement_else_clauses_have_no_attributes test in wgsl-parse.

cargo fmt, cargo clippy -p wgsl-parse -p wesl --all-targets -- -D warnings and cargo test -p wgsl-parse -p wesl all pass.

Closes #331

WGSL does not allow attributes on else-if or else branches. Drop the
WESL-only attributes fields from ElseIfClause and ElseClause, stop
printing them, and treat these nodes like IfClause for SyntaxNode.
@github-actions

Copy link
Copy Markdown

Welcome, new contributor!

Please make sure you have read our contributing guide and we look forward to reviewing your pull request shortly ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove attributes before else if and else clauses

3 participants