smite-scenarios: deduplicate executor variable resolvers - #232
Open
erickcestari wants to merge 1 commit into
Open
smite-scenarios: deduplicate executor variable resolvers#232erickcestari wants to merge 1 commit into
erickcestari wants to merge 1 commit into
Conversation
The 17 `resolve_*` functions differed only in the matched variant, and the two `consume_sent_*` functions only in the affine type they voided. Generate the resolvers with a `define_resolver!` macro that shares one `type_mismatch` panic, and replace the consumers with a single `consume_affine` that takes the expected `VariableType`.
Chand-ra
reviewed
Sep 5, 2026
| &FundingTransaction | ||
| ); | ||
|
|
||
| /// Consumes an affine variable, leaving its slot void so it cannot be used |
There was a problem hiding this comment.
Nit: Rust doesn't have "voids". What we're doing is replacing the used variable with None.
Something like this would perhaps be better?
Consumes an affine variable, replacing it with `None` to prevent double-use.
Contributor
Author
There was a problem hiding this comment.
We are using the term void in the codebase to refer to a None Variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 17
resolve_*functions differed only in the matched variant, and the twoconsume_sent_*functions only in the affine type they voided.Generate the resolvers with a
define_resolver!macro that shares onetype_mismatchpanic, and replace the consumers with a singleconsume_affinethat takes the expectedVariableType.