From 09f8e3b5113201d570f3f1658cf4f7fa7cc9cc28 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Tue, 17 Jan 2023 18:36:31 +0000 Subject: [PATCH] chore(deps): bump solang-parser 0.2.1 (#2054) --- Cargo.lock | 41 ++++++++++++++++--------------- ethers-solc/Cargo.toml | 2 +- ethers-solc/src/resolver/parse.rs | 19 +++++++------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee57c761..da05455b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2971,34 +2971,32 @@ dependencies = [ [[package]] name = "phf" -version = "0.10.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" dependencies = [ "phf_macros", - "phf_shared", - "proc-macro-hack", + "phf_shared 0.11.1", ] [[package]] name = "phf_generator" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" dependencies = [ - "phf_shared", + "phf_shared 0.11.1", "rand 0.8.5", ] [[package]] name = "phf_macros" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +checksum = "92aacdc5f16768709a569e913f7451034034178b05bdc8acda226659a3dccc66" dependencies = [ "phf_generator", - "phf_shared", - "proc-macro-hack", + "phf_shared 0.11.1", "proc-macro2", "quote", "syn", @@ -3013,6 +3011,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" +dependencies = [ + "siphasher", +] + [[package]] name = "pico-args" version = "0.4.2" @@ -3178,12 +3185,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - [[package]] name = "proc-macro2" version = "1.0.49" @@ -4021,9 +4022,9 @@ dependencies = [ [[package]] name = "solang-parser" -version = "0.1.18" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac8ac4bfef383f368bd9bb045107a501cd9cd0b64ad1983e1b7e839d6a44ecad" +checksum = "6e9653f278d9531b60f042c29732bb835d519943f4167b1e5684c7e820dd9fec" dependencies = [ "itertools", "lalrpop", @@ -4063,7 +4064,7 @@ dependencies = [ "new_debug_unreachable", "once_cell", "parking_lot 0.12.1", - "phf_shared", + "phf_shared 0.10.0", "precomputed-hash", ] diff --git a/ethers-solc/Cargo.toml b/ethers-solc/Cargo.toml index b39a7646..2c2098dd 100644 --- a/ethers-solc/Cargo.toml +++ b/ethers-solc/Cargo.toml @@ -37,7 +37,7 @@ tempfile = { version = "3.3.0", optional = true } fs_extra = { version = "1.2.0", optional = true } sha2 = { version = "0.10.6", default-features = false, optional = true } dunce = "1.0.3" -solang-parser = { default-features = false, version = "=0.1.18" } +solang-parser = { default-features = false, version = "=0.2.1" } rayon = "1.6.0" rand = { version = "0.8.5", optional = true } path-slash = "0.2.1" diff --git a/ethers-solc/src/resolver/parse.rs b/ethers-solc/src/resolver/parse.rs index 94436525..84592e67 100644 --- a/ethers-solc/src/resolver/parse.rs +++ b/ethers-solc/src/resolver/parse.rs @@ -49,7 +49,7 @@ impl SolData { Ok((units, _)) => { for unit in units.0 { match unit { - SourceUnitPart::PragmaDirective(loc, pragma, value) => { + SourceUnitPart::PragmaDirective(loc, Some(pragma), Some(value)) => { if pragma.name == "solidity" { // we're only interested in the solidity version pragma version = Some(SolDataUnit::from_loc(value.string.clone(), loc)); @@ -86,15 +86,16 @@ impl SolData { _ => None, }) .collect(); - let name = def.name.name; - match def.ty { - ContractTy::Contract(_) => { - contracts.push(SolContract { name, functions }); + if let Some(name) = def.name { + match def.ty { + ContractTy::Contract(_) => { + contracts.push(SolContract { name: name.name, functions }); + } + ContractTy::Library(_) => { + libraries.push(SolLibrary { name: name.name, functions }); + } + _ => {} } - ContractTy::Library(_) => { - libraries.push(SolLibrary { name, functions }); - } - _ => {} } } _ => {}