Skip to content

Commit

Permalink
chore: bump solang-parser to 0.3.0 (#5087)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Jun 1, 2023
1 parent 7f416aa commit cc5637a
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 50 deletions.
35 changes: 9 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ ethers-middleware = { version = "2.0.6", default-features = false }
ethers-etherscan = { version = "2.0.6", default-features = false }
ethers-solc = { version = "2.0.6", default-features = false }

solang-parser = "=0.3.0"

[patch.crates-io]
# ethers = { path = "../ethers-rs/ethers" }
# ethers-addressbook = { path = "../ethers-rs/ethers-addressbook" }
Expand Down
2 changes: 1 addition & 1 deletion chisel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ reqwest = { version = "0.11", default-features = false, features = ["rustls"] }
# misc
clap = { version = "4", features = ["derive", "env", "wrap_help"] }
rustyline = "11"
solang-parser = "=0.2.4"
solang-parser.workspace = true
yansi = "0.5"
strum = { version = "0.24", features = ["derive"] }
serde = "1"
Expand Down
1 change: 0 additions & 1 deletion chisel/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ impl Type {
pt::Expression::Type(_, ty) => Self::from_type(ty),

pt::Expression::Variable(ident) => Some(Self::Custom(vec![ident.name.clone()])),
pt::Expression::This(_) => Some(Self::Custom(vec!["this".to_string()])),

// array
pt::Expression::ArraySubscript(_, expr, num) => {
Expand Down
3 changes: 1 addition & 2 deletions chisel/src/solidity_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ impl<'a> TokenStyle for Token<'a> {
RationalNumber(_, _, _) |
HexNumber(_) |
True |
False |
This => Color::Yellow.style(),
False => Color::Yellow.style(),

Memory | Storage | Calldata | Public | Private | Internal | External | Constant |
Pure | View | Payable | Anonymous | Indexed | Abstract | Virtual | Override |
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ui = { path = "../ui" }

# eth
ethers = { workspace = true, features = ["rustls"] }
solang-parser = "=0.2.4"
solang-parser.workspace = true

# cli
clap = { version = "4", features = ["derive", "env", "unicode", "wrap_help"] }
Expand Down
2 changes: 1 addition & 1 deletion cli/src/cmd/forge/geiger/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl Visitor for CheatcodeVisitor {
_loc: Loc,
init: &mut Option<Box<Statement>>,
cond: &mut Option<Box<Expression>>,
update: &mut Option<Box<Statement>>,
update: &mut Option<Box<Expression>>,
body: &mut Option<Box<Statement>>,
) -> Result<(), Self::Error> {
init.visit(self)?;
Expand Down
2 changes: 1 addition & 1 deletion doc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
futures-util = "0.3"

# misc
solang-parser = "=0.2.4"
solang-parser.workspace = true
eyre = "0.6"
thiserror = "1"
rayon = "1"
Expand Down
2 changes: 1 addition & 1 deletion fmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ foundry-config = { path = "../config" }
ethers-core = { workspace = true }

# parser
solang-parser = "=0.2.4"
solang-parser.workspace = true

# misc
semver = "1"
Expand Down
18 changes: 4 additions & 14 deletions fmt/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2052,9 +2052,6 @@ impl<'a, W: Write> Visitor for Formatter<'a, W> {
// support of solana/substrate address literals
self.write_quoted_str(*loc, Some("address"), val)?;
}
Expression::This(loc) => {
write_chunk!(self, loc.start(), loc.end(), "this")?;
}
Expression::Parenthesis(loc, expr) => {
self.surrounded(
SurroundingChunk::new("(", Some(loc.start()), None),
Expand Down Expand Up @@ -2859,7 +2856,7 @@ impl<'a, W: Write> Visitor for Formatter<'a, W> {
loc: Loc,
init: &mut Option<Box<Statement>>,
cond: &mut Option<Box<Expression>>,
update: &mut Option<Box<Statement>>,
update: &mut Option<Box<Expression>>,
body: &mut Option<Box<Statement>>,
) -> Result<(), Self::Error> {
return_source_if_disabled!(self, loc);
Expand All @@ -2884,16 +2881,9 @@ impl<'a, W: Write> Visitor for Formatter<'a, W> {
fmt.write_whitespace_separator(true)?;
}

// Don't write a semi after the update expression
// This should be just an `Expression`, but it is parsed as a `Statement` for
// some reason in solang-parser
// See https://github.com/hyperledger/solang/issues/1283
match update.as_deref_mut() {
Some(Statement::Expression(loc, expr)) => fmt.visit_expr(*loc, expr),
Some(stmt) => {
unreachable!("Invalid Solidity for loop `update` expression: {stmt:?}")
}
_ => Ok(()),
match update {
Some(expr) => expr.visit(fmt),
None => Ok(()),
}
};
let multiline = !fmt.try_on_single_line(|fmt| write_for_loop_header(fmt, false))?;
Expand Down
1 change: 0 additions & 1 deletion fmt/src/solang_ext/ast_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ derive_ast_eq! { enum Expression {
Variable(ident1),
List(loc, params1),
ArrayLiteral(loc, exprs1),
This(loc),
Parenthesis(loc, expr)
_
}}
Expand Down
2 changes: 1 addition & 1 deletion fmt/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ pub trait Visitor {
loc: Loc,
_init: &mut Option<Box<Statement>>,
_cond: &mut Option<Box<Expression>>,
_update: &mut Option<Box<Statement>>,
_update: &mut Option<Box<Expression>>,
_body: &mut Option<Box<Statement>>,
) -> Result<(), Self::Error> {
self.visit_source(loc)
Expand Down

0 comments on commit cc5637a

Please sign in to comment.