From b546c7dc87e5544242d47b05c0ced31a9f6b46fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Gir=C3=A1ldez?= Date: Thu, 28 Nov 2024 17:21:53 -0500 Subject: [PATCH 1/2] Add missing `pop_begin`/`pop_end` for mapping types This is so bindings can be processed for files with using directives on mapping types without crashing. --- crates/solidity/inputs/language/bindings/rules.msgb | 6 ++++++ .../crate/src/generated/bindings/generated/binding_rules.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/crates/solidity/inputs/language/bindings/rules.msgb b/crates/solidity/inputs/language/bindings/rules.msgb index db1390c6c..c2b6ef1b7 100644 --- a/crates/solidity/inputs/language/bindings/rules.msgb +++ b/crates/solidity/inputs/language/bindings/rules.msgb @@ -767,6 +767,8 @@ inherit .lexical_scope @type_name [TypeName @mapping [MappingType]] { let @type_name.type_ref = @mapping.lexical_scope let @type_name.output = @mapping.output + let @type_name.pop_begin = @mapping.pop_begin + let @type_name.pop_end = @mapping.pop_end } @@ -845,6 +847,10 @@ inherit .lexical_scope ; resolve the value type through our scope edge @value_type.type_ref -> @mapping.lexical_scope + + ; We use the value_type's definition path as our, although that's not correct + let @mapping.pop_begin = @value_type.pop_begin + let @mapping.pop_end = @value_type.pop_end } diff --git a/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs b/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs index c28dc2449..912264e5a 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs @@ -772,6 +772,8 @@ inherit .lexical_scope @type_name [TypeName @mapping [MappingType]] { let @type_name.type_ref = @mapping.lexical_scope let @type_name.output = @mapping.output + let @type_name.pop_begin = @mapping.pop_begin + let @type_name.pop_end = @mapping.pop_end } @@ -850,6 +852,10 @@ inherit .lexical_scope ; resolve the value type through our scope edge @value_type.type_ref -> @mapping.lexical_scope + + ; We use the value_type's definition path as our, although that's not correct + let @mapping.pop_begin = @value_type.pop_begin + let @mapping.pop_end = @value_type.pop_end } From f4961a7ca6fbfad874d374b2ed2ad2c176a79059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Gir=C3=A1ldez?= Date: Mon, 2 Dec 2024 14:54:26 -0500 Subject: [PATCH 2/2] Fix and clarify comment --- crates/solidity/inputs/language/bindings/rules.msgb | 4 +++- .../crate/src/generated/bindings/generated/binding_rules.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/solidity/inputs/language/bindings/rules.msgb b/crates/solidity/inputs/language/bindings/rules.msgb index c2b6ef1b7..0e341a683 100644 --- a/crates/solidity/inputs/language/bindings/rules.msgb +++ b/crates/solidity/inputs/language/bindings/rules.msgb @@ -848,7 +848,9 @@ inherit .lexical_scope ; resolve the value type through our scope edge @value_type.type_ref -> @mapping.lexical_scope - ; We use the value_type's definition path as our, although that's not correct + ; We use the value_type's definition path as our own because it's needed when + ; a mapping is the target of a `using` directive. It's not correct, but we + ; don't have the analog referencing path either. let @mapping.pop_begin = @value_type.pop_begin let @mapping.pop_end = @value_type.pop_end } diff --git a/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs b/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs index 912264e5a..63e086289 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs @@ -853,7 +853,9 @@ inherit .lexical_scope ; resolve the value type through our scope edge @value_type.type_ref -> @mapping.lexical_scope - ; We use the value_type's definition path as our, although that's not correct + ; We use the value_type's definition path as our own because it's needed when + ; a mapping is the target of a `using` directive. It's not correct, but we + ; don't have the analog referencing path either. let @mapping.pop_begin = @value_type.pop_begin let @mapping.pop_end = @value_type.pop_end }