Skip to content

Commit cc5637a

Browse files
authored
chore: bump solang-parser to 0.3.0 (#5087)
1 parent 7f416aa commit cc5637a

File tree

12 files changed

+22
-50
lines changed

12 files changed

+22
-50
lines changed

Cargo.lock

Lines changed: 9 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ ethers-middleware = { version = "2.0.6", default-features = false }
7171
ethers-etherscan = { version = "2.0.6", default-features = false }
7272
ethers-solc = { version = "2.0.6", default-features = false }
7373

74+
solang-parser = "=0.3.0"
75+
7476
[patch.crates-io]
7577
# ethers = { path = "../ethers-rs/ethers" }
7678
# ethers-addressbook = { path = "../ethers-rs/ethers-addressbook" }

chisel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ reqwest = { version = "0.11", default-features = false, features = ["rustls"] }
3737
# misc
3838
clap = { version = "4", features = ["derive", "env", "wrap_help"] }
3939
rustyline = "11"
40-
solang-parser = "=0.2.4"
40+
solang-parser.workspace = true
4141
yansi = "0.5"
4242
strum = { version = "0.24", features = ["derive"] }
4343
serde = "1"

chisel/src/executor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ impl Type {
408408
pt::Expression::Type(_, ty) => Self::from_type(ty),
409409

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

413412
// array
414413
pt::Expression::ArraySubscript(_, expr, num) => {

chisel/src/solidity_helper.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ impl<'a> TokenStyle for Token<'a> {
295295
RationalNumber(_, _, _) |
296296
HexNumber(_) |
297297
True |
298-
False |
299-
This => Color::Yellow.style(),
298+
False => Color::Yellow.style(),
300299

301300
Memory | Storage | Calldata | Public | Private | Internal | External | Constant |
302301
Pure | View | Payable | Anonymous | Indexed | Abstract | Virtual | Override |

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ui = { path = "../ui" }
2424

2525
# eth
2626
ethers = { workspace = true, features = ["rustls"] }
27-
solang-parser = "=0.2.4"
27+
solang-parser.workspace = true
2828

2929
# cli
3030
clap = { version = "4", features = ["derive", "env", "unicode", "wrap_help"] }

cli/src/cmd/forge/geiger/visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl Visitor for CheatcodeVisitor {
306306
_loc: Loc,
307307
init: &mut Option<Box<Statement>>,
308308
cond: &mut Option<Box<Expression>>,
309-
update: &mut Option<Box<Statement>>,
309+
update: &mut Option<Box<Expression>>,
310310
body: &mut Option<Box<Statement>>,
311311
) -> Result<(), Self::Error> {
312312
init.visit(self)?;

doc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
3232
futures-util = "0.3"
3333

3434
# misc
35-
solang-parser = "=0.2.4"
35+
solang-parser.workspace = true
3636
eyre = "0.6"
3737
thiserror = "1"
3838
rayon = "1"

fmt/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ foundry-config = { path = "../config" }
1616
ethers-core = { workspace = true }
1717

1818
# parser
19-
solang-parser = "=0.2.4"
19+
solang-parser.workspace = true
2020

2121
# misc
2222
semver = "1"

fmt/src/formatter.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,9 +2052,6 @@ impl<'a, W: Write> Visitor for Formatter<'a, W> {
20522052
// support of solana/substrate address literals
20532053
self.write_quoted_str(*loc, Some("address"), val)?;
20542054
}
2055-
Expression::This(loc) => {
2056-
write_chunk!(self, loc.start(), loc.end(), "this")?;
2057-
}
20582055
Expression::Parenthesis(loc, expr) => {
20592056
self.surrounded(
20602057
SurroundingChunk::new("(", Some(loc.start()), None),
@@ -2859,7 +2856,7 @@ impl<'a, W: Write> Visitor for Formatter<'a, W> {
28592856
loc: Loc,
28602857
init: &mut Option<Box<Statement>>,
28612858
cond: &mut Option<Box<Expression>>,
2862-
update: &mut Option<Box<Statement>>,
2859+
update: &mut Option<Box<Expression>>,
28632860
body: &mut Option<Box<Statement>>,
28642861
) -> Result<(), Self::Error> {
28652862
return_source_if_disabled!(self, loc);
@@ -2884,16 +2881,9 @@ impl<'a, W: Write> Visitor for Formatter<'a, W> {
28842881
fmt.write_whitespace_separator(true)?;
28852882
}
28862883

2887-
// Don't write a semi after the update expression
2888-
// This should be just an `Expression`, but it is parsed as a `Statement` for
2889-
// some reason in solang-parser
2890-
// See https://github.com/hyperledger/solang/issues/1283
2891-
match update.as_deref_mut() {
2892-
Some(Statement::Expression(loc, expr)) => fmt.visit_expr(*loc, expr),
2893-
Some(stmt) => {
2894-
unreachable!("Invalid Solidity for loop `update` expression: {stmt:?}")
2895-
}
2896-
_ => Ok(()),
2884+
match update {
2885+
Some(expr) => expr.visit(fmt),
2886+
None => Ok(()),
28972887
}
28982888
};
28992889
let multiline = !fmt.try_on_single_line(|fmt| write_for_loop_header(fmt, false))?;

0 commit comments

Comments
 (0)