Skip to content
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

[move-compiler] Add macro for "simple" visitors #20062

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

tnowacki
Copy link
Contributor

Description

  • Add a macro for the simple visitor declarations

Test plan

  • Updated one test

Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Oct 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 28, 2024 9:17pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Oct 28, 2024 9:17pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Oct 28, 2024 9:17pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Oct 28, 2024 9:17pm

Copy link
Contributor Author

@tnowacki tnowacki left a comment

Choose a reason for hiding this comment

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

I had some rustfmt issues, that I wasn't able to solve very cleanly. If anyone knows alternatives, please let me know!

@@ -327,6 +327,51 @@ impl<V: CFGIRVisitorConstructor + Send + Sync> CFGIRVisitor for V {
}
}

macro_rules! simple_visitor {
($visitor:ident, $($overrides:item),*) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need the ,* to get rustfmt to work

@@ -66,8 +41,7 @@ impl TypingVisitorContext for Context<'_> {
}
}
false
}

},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rustfmt adds the , here regardless of the declaration syntax when using parens at the invocation

self.env.pop_warning_filter_scope()
}

simple_visitor!(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have simple_visitor!( instead of something like simple_visitor! { to enable rustfmt

Copy link
Contributor

@cgswords cgswords left a comment

Choose a reason for hiding this comment

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

LGTM

@tnowacki tnowacki merged commit cb80140 into MystenLabs:main Oct 28, 2024
48 checks passed
@tnowacki tnowacki deleted the simple branch October 28, 2024 22:39
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.

2 participants