-
Notifications
You must be signed in to change notification settings - Fork 213
refactor: break SolInput to its own crate #578
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
Merged
+327
−138
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9277b76
refactor: break SolInputs to its own crate
prestwich ff70655
fix: explicit quote import
prestwich 68ad52d
nits: cargo.toml keys for new package
prestwich 01170fd
nit: newline
prestwich be83e2d
refator: push attr down
prestwich 6f30ca5
nit: remove empty file
prestwich d29869a
refactor: introduce ContainsSolAttrs
prestwich 72481c5
docs: delete broken link
prestwich c7db85a
fix: migrate udt and fix docs
prestwich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "alloy-sol-macro-input" | ||
description = "Input types for sol!-like macros" | ||
keywords = ["ethereum", "abi", "encoding", "evm", "solidity"] | ||
categories = ["encoding", "cryptography::cryptocurrencies"] | ||
homepage = "https://github.com/alloy-rs/core/tree/main/crates/sol-macro-input" | ||
|
||
version.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
exclude.workspace = true | ||
|
||
[dependencies] | ||
dunce = "1.0.4" | ||
heck = "0.5.0" | ||
hex.workspace = true | ||
proc-macro2.workspace = true | ||
syn.workspace = true | ||
syn-solidity.workspace = true | ||
quote.workspace = true | ||
|
||
# json | ||
alloy-json-abi = { workspace = true, optional = true } | ||
serde_json = { workspace = true, optional = true } | ||
|
||
[features] | ||
json = ["dep:alloy-json-abi", "dep:serde_json"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use proc_macro2::TokenStream; | ||
|
||
use crate::SolInput; | ||
|
||
/// Expands a `SolInput` into a `TokenStream`. | ||
pub trait SolInputExpander { | ||
/// Expand a `SolInput` into a `TokenStream`. | ||
fn expand(&mut self, input: &SolInput) -> syn::Result<TokenStream>; | ||
} |
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
110 changes: 66 additions & 44 deletions
110
crates/sol-macro/src/json.rs → crates/sol-macro-input/src/json.rs
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! This crate contains inputs to the `sol!` macro. It sits in-between | ||
//! the `sol-macro` and `syn-solidity` crates, and contains an intermediate | ||
//! representation of Solidity items. These items are then expanded into | ||
//! Rust code by the `alloy-sol-macro` crate. | ||
//! | ||
//! This crate is not meant to be used directly, but rather is a tool for | ||
//! writing macros that generate Rust code from Solidity code. | ||
#![doc( | ||
html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", | ||
html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" | ||
)] | ||
#![warn(missing_copy_implementations, missing_debug_implementations, missing_docs, rustdoc::all)] | ||
#![cfg_attr(not(test), warn(unused_crate_dependencies))] | ||
#![deny(unused_must_use, rust_2018_idioms)] | ||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] | ||
|
||
/// Tools for working with `#[...]` attributes. | ||
mod attr; | ||
pub use attr::{derives_mapped, docs_str, mk_doc, ContainsSolAttrs, SolAttrs}; | ||
|
||
mod input; | ||
pub use input::{SolInput, SolInputKind}; | ||
|
||
mod expander; | ||
pub use expander::SolInputExpander; | ||
|
||
#[cfg(feature = "json")] | ||
mod json; | ||
|
||
extern crate syn_solidity as ast; | ||
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
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
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
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
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
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
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
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
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
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
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.
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.
move above mods?