From ecc48e18b2de446c419eda4d19cf4929abba4d94 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Fri, 10 Nov 2023 14:42:32 +0100 Subject: [PATCH] fix: Use the DSL v1 mechanism for versioning --- crates/solidity/inputs/language/src/definition.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 194c846142..84d0f67cf4 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -575,10 +575,15 @@ fn resolve_precedence( OnceCell::new(), )); + // NOTE: The DSL v1 model defines operators as having the same body definitions but uses a specific + // versioning mechanism. This is in contrast to the DSL v2, which allows for different body definitions and + // different versions. + // Thus, we shoehorn the v2 model into the first one, by creating a single parser definition node as + // a choice over the different versions of the operator body, but still define it multiple times in the DSL v1 + // model with an explicit version, that the codegen handles for us. for op in &expr.operators { operators.push(( - // Parser definition done below is already taking care of versioning - vec![], + op.enabled.clone().map(enabled_to_range).unwrap_or_default(), model_to_enum(op.model), // TODO: Don't leak expr.rule_name.to_string().leak() as &_,