-
Notifications
You must be signed in to change notification settings - Fork 322
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
refactor: function macros cleanup #12066
refactor: function macros cleanup #12066
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
0f6b664
to
2c5df4b
Compare
@@ -16,16 +16,35 @@ pub trait CallInterface<let N: u32> { | |||
} | |||
|
|||
pub struct PrivateCallInterface<let N: u32, T> { |
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.
As Nico proposed in a PR down the stack - makes sense to have the args private and instead use the new method. All the changes in this file are a reflection of that.
@@ -0,0 +1,35 @@ | |||
use std::meta::type_of; | |||
|
|||
pub(crate) comptime fn create_fn_abi_export(f: FunctionDefinition) -> Quoted { |
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.
Moved this function from intercaces.nr as that file was too cluttered. There is no code change here.
|
||
comptime global SERIALIZED_ARGS_SLICE_NAME: Quoted = quote { serialized_args }; | ||
|
||
pub comptime fn stub_fn(f: FunctionDefinition) -> Quoted { |
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 function was originally in interfaces.nr
but I have completely rewrote it because it was impossible to read. In hindsight I shouldn't have moved it in the same PR. Sorry for the bad diff. (The diff would be huge here anyway as I reshufled it)
let is_static_call = is_fn_view(f); | ||
let is_void = f.return_type() == type_of(()); | ||
|
||
if is_fn_private(f) { |
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 the main change here. I branch into individual cases and there I return the complete quote from there.
@@ -1,14 +1,10 @@ | |||
pub mod interfaces; | |||
pub mod initialization_utils; |
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.
I found this file very hard to read so I decided to keep here only the public functions and moved the rest to other files.
// Marker attribute | ||
} | ||
|
||
comptime fn create_internal_check(f: FunctionDefinition) -> Quoted { |
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.
Moved these utility functions to utils.nr in the same folder.
@@ -0,0 +1,19 @@ | |||
use std::{collections::umap::UHashMap, hash::{BuildHasherDefault, poseidon2::Poseidon2Hasher}}; |
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 got moved in here from interfaces.nr
. The other change here is that instead of exposing the STUBS global I just expose the setter and getter. This makes it nicer to read as everywhere we either use only the getter or the setter.
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.
lovely
@@ -0,0 +1,320 @@ | |||
use crate::macros::{ |
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.
All the code here is just copied from mod.nr
.
@@ -148,7 +148,7 @@ comptime fn signature_of_type(typ: Type) -> Quoted { | |||
} | |||
} | |||
|
|||
trait AsStrQuote { | |||
pub(crate) trait AsStrQuote { |
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.
Did this to fix warnings when importing it.
b396777
to
a1e5a72
Compare
518ab62
to
a21c5bc
Compare
b16a373
to
fc2655a
Compare
381501c
to
fb8222e
Compare
eba9bf3
to
2c9a324
Compare
2c9a324
to
ff5849b
Compare
* master: (245 commits) chore: Fix unbound CI variable on release image bootstrap (#12095) fix: dry run on grind (#12088) fix(spartan): eth-execution logging (#12094) fix: aws_handle_evict recovery & termination (#12086) chore: Use native acvm when available on orchestrator tests (#11560) refactor: function macros cleanup (#12066) refactor: remove `addNullifiedNote` from pxe (#11822) fix: `#[aztec]` macro warnings (#12038) refactor!: Notes implementing `Packable<N>` (#12004) chore(ops): add gcloud cli into devbox base image (#12082) fix: hotfix grinding fix: L1 deployment on reth (#12060) fix: Add missing bootstrap fast aliases (#12078) fix: hash_str caching (#12074) fix: Naive attempt to fix nightly deployments (#12079) fix: kind smoke (#12084) refactor!: nuking `NoteHeader` (#11942) fix: inject dockerhub creds (#12072) feat(docs): Note discovery concepts page (#11760) chore: cleanup libp2p logger (#12058) ...
stub_fn
readable.