Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Will-Smith11 committed Nov 10, 2023
1 parent 81eda38 commit c1605d2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 39 deletions.
21 changes: 1 addition & 20 deletions crates/json-abi/tests/abi/ZeroxExchangeProxy.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
}
],
"name": "getFunctionImplementation",
"inputs": [],
"outputs": [
{
"internalType": "address",
Expand All @@ -26,9 +11,5 @@
],
"stateMutability": "view",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
1 change: 0 additions & 1 deletion crates/sol-macro/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ impl SolInput {

pub fn expand(self) -> Result<TokenStream> {
let Self { attrs, path, kind } = self;

let include = path.map(|p| {
let p = p.to_str().unwrap();
quote! { const _: &'static [u8] = ::core::include_bytes!(#p); }
Expand Down
2 changes: 1 addition & 1 deletion crates/sol-type-parser/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub const fn is_id_start(c: char) -> bool {
/// Returns `true` if the given character is valid in a Solidity identifier.
#[inline]
pub const fn is_id_continue(c: char) -> bool {
matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '_' | '$' | '#')
matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '_' | '$')
}

/// Returns `true` if the given string is a valid Solidity identifier.
Expand Down
28 changes: 11 additions & 17 deletions crates/syn-solidity/src/ident/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::Spanned;
use proc_macro2::{Ident, Span};
use quote::ToTokens;
use quote::{ToTokens};
use std::fmt;
use syn::{
ext::IdentExt,
Expand Down Expand Up @@ -60,12 +60,7 @@ impl From<Ident> for SolIdent {

impl From<SolIdent> for Ident {
fn from(value: SolIdent) -> Self {
let str = value.0.to_string();
if RUST_KEYWORD_SET_DIFFERENCE.contains(&str.as_str()) {
Ident::new_raw(&str, value.span())
} else {
Ident::new(&str, value.span())
}
value.0
}
}

Expand All @@ -84,13 +79,7 @@ impl Parse for SolIdent {

impl ToTokens for SolIdent {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
let str = self.0.to_string();
if RUST_KEYWORD_SET_DIFFERENCE.contains(&str.as_str()) {
Ident::new_raw(&str, self.span())
} else {
Ident::new(&str, self.span())
}
.to_tokens(tokens)
self.0.to_tokens(tokens);
}
}

Expand All @@ -106,11 +95,15 @@ impl Spanned for SolIdent {

impl SolIdent {
pub fn new(s: &str) -> Self {
Self(Ident::new(s, Span::call_site()))
Self::new_spanned(s, Span::call_site())
}

pub fn new_spanned(s: &str, span: Span) -> Self {
Self(Ident::new(s, span))
if RUST_KEYWORD_SET_DIFFERENCE.contains(&s) {
Self(Ident::new_raw(s, span))
} else {
Self(Ident::new(s, span))
}
}

/// Strips the raw marker `r#`, if any, from the beginning of an ident.
Expand Down Expand Up @@ -139,7 +132,8 @@ impl SolIdent {
/// Parses any identifier including keywords.
pub fn parse_any(input: ParseStream<'_>) -> Result<Self> {
check_dollar(input)?;
input.call(Ident::parse_any).map(Self)

input.call(Ident::parse_any).map(Into::into)
}

/// Peeks any identifier including keywords.
Expand Down

0 comments on commit c1605d2

Please sign in to comment.