-
Notifications
You must be signed in to change notification settings - Fork 100
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
Rewrite of parts of the #[public]
macro
#1193
base: main
Are you sure you want to change the base?
Conversation
#[public]
macro
// pass parameter if ignored with underscore | ||
if matches!(*pat_type.pat, Pat::Wild(_)) { | ||
pat_type.pat = Box::new(Pat::Ident(PatIdent { | ||
attrs: vec![], | ||
by_ref: None, | ||
mutability: None, | ||
ident: Ident::new("_ctx", Span::call_site()), | ||
subpat: None, | ||
})) |
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.
This is now needed because the parameters are all user-defined. Meaning that the context that used to be param_0
as expected could also be a wildcard _
and this parameter cannot be passed around.
Now the issue is that this is going to fail if any other parameter is named _ctx
such as with this function signature:
#[public]
pub fn inc(_: Context, _ctx: Context, external: Program, address: Address)
Closes #1183
Copy parameters in bindings definition:
The parameter names used to be
param_0
,param_1
, ...The original parameter names have been copied to have better docs and LSP support.
You can verify this with
cargo doc -p counter -F bindings --open
As part of this, much of the code could be simplified further