Skip to content

Conversation

@teoxoy
Copy link
Member

@teoxoy teoxoy commented Oct 20, 2025

Connections
Resolves #4501.
Resolves #4406.
Resolves #4405.

Description
Almost all commits prior to implement template list discovery are refactors to get the frontend to look more similar to the spec and to make the needed changes easier to implement (most notably making the Tokenizer no longer impl Clone).

The template list discovery implementation differs from the spec only in structure (not in behavior) since we can do it lazily after tokenization.

The last 3 substantial commits move all type resolution to the lowerer since all identifiers that are part of types need to be resolved the same as all other identifiers.

Testing
Changed existing tests and added new ones.

Squash or Rebase?
Rebase.

teoxoy added 30 commits August 21, 2025 18:15
also fixes spans in some cases
@teoxoy teoxoy force-pushed the tld branch 2 times, most recently from 9c99aa1 to d4b4df4 Compare October 20, 2025 16:36
@ErichDonGubler ErichDonGubler self-assigned this Oct 20, 2025
@jimblandy
Copy link
Member

I can take review here - I've been looking into this for a long time.

@jimblandy
Copy link
Member

@teoxoy It seems like a bunch of these early commits would be fine as independent cleanup PRs, like 42338ff and 4adede5.

Token::End => "end".to_string(),
},
ExpectedToken::Identifier => "identifier".to_string(),
ExpectedToken::LhsExpression => "lhs_expression".to_string(),
Copy link
Member

@jimblandy jimblandy Oct 21, 2025

Choose a reason for hiding this comment

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

I think lhs_expression is spec jargon. Isn't there something we could say here that would be more readily recognized by WGSL programmers? "expression to be assigned to"? "destination for assignment"?

(Spec jargon is fine when we need to be precise and there's nothing better.)

Copy link
Member Author

Choose a reason for hiding this comment

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

"destination for assignment"/"assignment destination" sound good.
It's also used by increment/decrement statements but it's probably ok?

@jimblandy
Copy link
Member

jimblandy commented Oct 21, 2025

So far I've reviewed the following commits and they all look fine:

527cf31a1 | * rename `function_call_or_assignment_statement` to `func_call_or_variable_updating_statement`
16c2777ba | * rename `function_statement` to `func_call_statement`
086c0e4c3 | * remove `lexer.clone()`
fe63d0753 | * rename `postfix` to `component_or_swizzle_specifier`
47108f674 | * update `lhs_expression` to be in line with the spec
75fbca1ed | * remove `peek_ident_with_span`
ed6a03205 | * remove `next_scalar_generic`
e99eb0149 | * rename `general_expression` to `expression`
54fe3ca2e | * rename `assignment_statement` to `variable_updating_statement`
4adede577 | * [wgsl] rename `type_decl` to `type_specifier`
42338fff3 | * add `optionally_typed_ident` fn

@teoxoy teoxoy force-pushed the tld branch 2 times, most recently from 84846b1 to 5f4abe6 Compare October 22, 2025 12:15
@teoxoy
Copy link
Member Author

teoxoy commented Oct 22, 2025

I removed the last commit that was adding a CTS test since it wasn't passing due to unrelated reasons and pushed 2 more commits to fix the issues CI surfaced.

@teoxoy
Copy link
Member Author

teoxoy commented Oct 22, 2025

@teoxoy It seems like a bunch of these early commits would be fine as independent cleanup PRs, like 42338ff and 4adede5.

They could but that would be lots of separate PRs to file and orchestrate since I think some of them depend on others. I could open a PR just with the refactor commits but then this PR would need to depend on that new one. Let me know.

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.

Implement WGSL template list discovery Allow shadowing of predeclared types and built-in functions [wgsl-in] Remove some texture types

3 participants