From c35a04c9b2357bad49b0b71167c6a171f5c65380 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Thu, 7 Mar 2024 19:32:01 +0100 Subject: [PATCH] fix: Introduce a separate, non-empty `CallOptions` rule --- .../inputs/language/src/definition.rs | 15 ++++++++--- .../slang_solidity/src/generated/kinds.rs | 1 + .../slang_solidity/src/generated/language.rs | 23 +++++++++++++--- .../generated/napi_interface/ast_selectors.rs | 27 ++++++++++++++++++- .../generated/function_call_expression.rs | 5 ++++ .../package/src/ast/generated/ast_types.ts | 24 +++++++++++++++-- .../npm/package/src/generated/index.d.ts | 1 + .../outputs/spec/generated/grammar.ebnf | 5 +++- .../05-expressions/02-function-calls.md | 8 +++++- .../generated/0.6.2-success.yml | 2 +- .../generated/0.6.2-failure.yml | 4 +-- .../generated/0.7.0-failure.yml | 4 +-- .../generated/0.8.0-failure.yml | 4 +-- .../generated/0.6.2-success.yml | 2 +- .../generated/0.6.2-success.yml | 4 +-- .../generated/0.6.2-success.yml | 2 +- .../generated/0.6.2-success.yml | 2 +- .../generated/0.6.2-success.yml | 2 +- .../generated/0.4.11-success.yml | 23 ++++++++++++++++ .../empty_named_arguments/input.sol | 2 ++ .../generated/0.6.2-success.yml | 2 +- 21 files changed, 137 insertions(+), 25 deletions(-) create mode 100644 crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/generated/0.4.11-success.yml create mode 100644 crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/input.sol diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 7078c07c64..32520ed4b3 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -3390,7 +3390,7 @@ codegen_language_macros::compile!(Language( delimiters = FieldDelimiters( open = open_brace, close = close_brace, - // NOTE: Despite `NamedArguments` requiring at least one element, + // NOTE: Despite `CallOptions` requiring at least one element, // we can only recover if we found at least two tokens (`ident:`) // in the body, as this may be otherwise ambiguous with // `try { func() } catch {}`. @@ -3399,7 +3399,7 @@ codegen_language_macros::compile!(Language( ), fields = ( open_brace = Required(OpenBrace), - arguments = Required(NamedArguments), + arguments = Required(CallOptions), close_brace = Required(CloseBrace) ) )] @@ -3525,7 +3525,16 @@ codegen_language_macros::compile!(Language( Separated( name = NamedArguments, reference = NamedArgument, - separator = Comma + separator = Comma, + allow_empty = true + ), + Separated( + name = CallOptions, + reference = NamedArgument, + separator = Comma, + enabled = From("0.6.2"), + // These cannot be empty as they're ambiguous with `try {} catch {}` + allow_empty = false ), Struct( name = NamedArgument, diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds.rs index debda2771e..f619da8b8e 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds.rs @@ -35,6 +35,7 @@ pub enum RuleKind { BitwiseXorExpression, Block, BreakStatement, + CallOptions, CallOptionsExpression, CatchClause, CatchClauseError, diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs index 091661b35c..c54a05a1cb 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs @@ -603,6 +603,22 @@ impl Language { .with_kind(RuleKind::BreakStatement) } + #[allow(unused_assignments, unused_parens)] + fn call_options(&self, input: &mut ParserContext<'_>) -> ParserResult { + if self.version_is_at_least_0_6_2 { + SeparatedHelper::run::<_, LexicalContextType::Default>( + input, + self, + |input| self.named_argument(input).with_label(NodeLabel::Item), + TokenKind::Comma, + NodeLabel::Separator, + ) + } else { + ParserResult::disabled() + } + .with_kind(RuleKind::CallOptions) + } + #[allow(unused_assignments, unused_parens)] fn call_options_expression(&self, input: &mut ParserContext<'_>) -> ParserResult { let result = self.expression(input); @@ -2103,7 +2119,7 @@ impl Language { TokenKind::OpenBrace, ), )?; - seq . elem (self . named_arguments (input) . with_label (NodeLabel :: Arguments) . recover_until_with_nested_delims :: < _ , LexicalContextType :: Default > (input , self , TokenKind :: CloseBrace , TokenAcceptanceThreshold (2u8) ,)) ? ; + seq . elem (self . call_options (input) . with_label (NodeLabel :: Arguments) . recover_until_with_nested_delims :: < _ , LexicalContextType :: Default > (input , self , TokenKind :: CloseBrace , TokenAcceptanceThreshold (2u8) ,)) ? ; seq.elem_labeled( NodeLabel::CloseBrace, self.parse_token_with_trivia::( @@ -3548,13 +3564,13 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn named_arguments(&self, input: &mut ParserContext<'_>) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::Default>( + OptionalHelper::transform(SeparatedHelper::run::<_, LexicalContextType::Default>( input, self, |input| self.named_argument(input).with_label(NodeLabel::Item), TokenKind::Comma, NodeLabel::Separator, - ) + )) .with_kind(RuleKind::NamedArguments) } @@ -8937,6 +8953,7 @@ impl Language { RuleKind::BitwiseXorExpression => Self::bitwise_xor_expression.parse(self, input, true), RuleKind::Block => Self::block.parse(self, input, true), RuleKind::BreakStatement => Self::break_statement.parse(self, input, true), + RuleKind::CallOptions => Self::call_options.parse(self, input, true), RuleKind::CallOptionsExpression => { Self::call_options_expression.parse(self, input, true) } diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs index 41a37e5ee9..0b8684ffff 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs @@ -1172,7 +1172,7 @@ impl Selector { Ok(vec![ Some(self.select(|node| node.is_rule_with_kind(RuleKind::Expression))?), Some(self.select(|node| node.is_token_with_kind(TokenKind::OpenBrace))?), - Some(self.select(|node| node.is_rule_with_kind(RuleKind::NamedArguments))?), + Some(self.select(|node| node.is_rule_with_kind(RuleKind::CallOptions))?), Some(self.select(|node| node.is_token_with_kind(TokenKind::CloseBrace))?), ]) } @@ -2585,6 +2585,7 @@ pub fn select_separated( RuleKind::TupleDeconstructionElements => selector.tuple_deconstruction_elements()?, RuleKind::PositionalArguments => selector.positional_arguments()?, RuleKind::NamedArguments => selector.named_arguments()?, + RuleKind::CallOptions => selector.call_options()?, RuleKind::TupleValues => selector.tuple_values()?, RuleKind::ArrayValues => selector.array_values()?, RuleKind::IdentifierPath => selector.identifier_path()?, @@ -2917,6 +2918,30 @@ impl Selector { } } +impl Selector { + fn call_options(&mut self) -> Result>> { + let mut separated = vec![]; + let mut separators = vec![]; + + if let Some(first) = + self.try_select(|node| node.is_rule_with_kind(RuleKind::NamedArgument))? + { + separated.push(first); + + while let Some(separator) = + self.try_select(|node| node.is_token_with_kind(TokenKind::Comma))? + { + separators.push(separator); + + separated + .push(self.select(|node| node.is_rule_with_kind(RuleKind::NamedArgument))?); + } + } + + Ok(vec![separated, separators]) + } +} + impl Selector { fn tuple_values(&mut self) -> Result>> { let mut separated = vec![]; diff --git a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/function_call_expression.rs b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/function_call_expression.rs index e74ab48b1d..47e199330a 100644 --- a/crates/solidity/outputs/cargo/tests/src/cst_output/generated/function_call_expression.rs +++ b/crates/solidity/outputs/cargo/tests/src/cst_output/generated/function_call_expression.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::cst_output::runner::run; +#[test] +fn empty_named_arguments() -> Result<()> { + run("FunctionCallExpression", "empty_named_arguments") +} + #[test] fn payable_conversion() -> Result<()> { run("FunctionCallExpression", "payable_conversion") diff --git a/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts b/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts index cb04262a30..b9abafe59b 100644 --- a/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts +++ b/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts @@ -2888,7 +2888,7 @@ export class CallOptionsExpression { return { operand: new Expression($operand as RuleNode), openBrace: $openBrace as TokenNode, - arguments: new NamedArguments($arguments as RuleNode), + arguments: new CallOptions($arguments as RuleNode), closeBrace: $closeBrace as TokenNode, }; }); @@ -2905,7 +2905,7 @@ export class CallOptionsExpression { return this.fetch().openBrace; } - public get arguments(): NamedArguments { + public get arguments(): CallOptions { return this.fetch().arguments; } @@ -5895,6 +5895,26 @@ export class NamedArguments { } } +export class CallOptions { + private readonly fetch = once(() => { + const [items, separators] = ast_internal.selectSeparated(this.cst); + + return { items: items.map((item) => new NamedArgument(item as RuleNode)), separators: separators as TokenNode[] }; + }); + + public constructor(public readonly cst: RuleNode) { + assertKind(this.cst.kind, RuleKind.CallOptions); + } + + public get items(): readonly NamedArgument[] { + return this.fetch().items; + } + + public get separators(): readonly TokenNode[] { + return this.fetch().separators; + } +} + export class TupleValues { private readonly fetch = once(() => { const [items, separators] = ast_internal.selectSeparated(this.cst); diff --git a/crates/solidity/outputs/npm/package/src/generated/index.d.ts b/crates/solidity/outputs/npm/package/src/generated/index.d.ts index 7dc5da22c9..672b7ad067 100644 --- a/crates/solidity/outputs/npm/package/src/generated/index.d.ts +++ b/crates/solidity/outputs/npm/package/src/generated/index.d.ts @@ -27,6 +27,7 @@ export namespace kinds { BitwiseXorExpression = "BitwiseXorExpression", Block = "Block", BreakStatement = "BreakStatement", + CallOptions = "CallOptions", CallOptionsExpression = "CallOptionsExpression", CatchClause = "CatchClause", CatchClauseError = "CatchClauseError", diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index 59bba237ed..df8d0e3256 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -1164,7 +1164,10 @@ NamedArgumentGroup = OPEN_BRACE NamedArguments CLOSE_BRACE; -NamedArguments = NamedArgument (COMMA NamedArgument)*; +NamedArguments = (NamedArgument (COMMA NamedArgument)*)?; + +(* Introduced in 0.6.2 *) +CallOptions = NamedArgument (COMMA NamedArgument)*; NamedArgument = IDENTIFIER COLON diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md b/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md index 50030fc356..54916576bc 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md @@ -38,7 +38,13 @@ ``` -
NamedArguments = NamedArgument (COMMA NamedArgument)*;
+
NamedArguments = (NamedArgument (COMMA NamedArgument)*)?;
+ +```{ .ebnf #CallOptions } + +``` + +
(* Introduced in 0.6.2 *)
CallOptions = NamedArgument (COMMA NamedArgument)*;
```{ .ebnf #NamedArgument } diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml index 99e3c9eef2..f5deb8ee4d 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml @@ -115,7 +115,7 @@ Tree: - (period꞉ Period): "." # (234..235) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "call" # (235..239) - (open_brace꞉ OpenBrace): "{" # (239..240) - - (arguments꞉ NamedArguments): # " value: amount" (240..254) + - (arguments꞉ CallOptions): # " value: amount" (240..254) - (item꞉ NamedArgument): # " value: amount" (240..254) - (LeadingTrivia) ► (Whitespace): " " # (240..241) - (name꞉ Identifier): "value" # (241..246) diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml index 2f917842ea..db0b93271d 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml @@ -184,7 +184,7 @@ Tree: - (period꞉ Period): "." # (179..180) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "call" # (180..184) - (open_brace꞉ OpenBrace): "{" # (184..185) - - (arguments꞉ NamedArguments): # "arg: 1, missing_expr: , no_semicolon," (185..222) + - (arguments꞉ CallOptions): # "arg: 1, missing_expr: , no_semicolon," (185..222) - (item꞉ NamedArgument): # "arg: 1" (185..191) - (name꞉ Identifier): "arg" # (185..188) - (colon꞉ Colon): ":" # (188..189) @@ -225,7 +225,7 @@ Tree: - (period꞉ Period): "." # (242..243) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "call" # (243..247) - (open_brace꞉ OpenBrace): "{" # (247..248) - - (arguments꞉ NamedArguments): # "arg: 1" (248..254) + - (arguments꞉ CallOptions): # "arg: 1" (248..254) - (item꞉ NamedArgument): # "arg: 1" (248..254) - (name꞉ Identifier): "arg" # (248..251) - (colon꞉ Colon): ":" # (251..252) diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml index a9b53005ab..28b23258c9 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml @@ -184,7 +184,7 @@ Tree: - (period꞉ Period): "." # (179..180) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "call" # (180..184) - (open_brace꞉ OpenBrace): "{" # (184..185) - - (arguments꞉ NamedArguments): # "arg: 1, missing_expr: , no_semicolon," (185..222) + - (arguments꞉ CallOptions): # "arg: 1, missing_expr: , no_semicolon," (185..222) - (item꞉ NamedArgument): # "arg: 1" (185..191) - (name꞉ Identifier): "arg" # (185..188) - (colon꞉ Colon): ":" # (188..189) @@ -225,7 +225,7 @@ Tree: - (period꞉ Period): "." # (242..243) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "call" # (243..247) - (open_brace꞉ OpenBrace): "{" # (247..248) - - (arguments꞉ NamedArguments): # "arg: 1" (248..254) + - (arguments꞉ CallOptions): # "arg: 1" (248..254) - (item꞉ NamedArgument): # "arg: 1" (248..254) - (name꞉ Identifier): "arg" # (248..251) - (colon꞉ Colon): ":" # (251..252) diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml index 5bdb58d931..49b3dd1723 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml @@ -184,7 +184,7 @@ Tree: - (period꞉ Period): "." # (179..180) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "call" # (180..184) - (open_brace꞉ OpenBrace): "{" # (184..185) - - (arguments꞉ NamedArguments): # "arg: 1, missing_expr: , no_semicolon," (185..222) + - (arguments꞉ CallOptions): # "arg: 1, missing_expr: , no_semicolon," (185..222) - (item꞉ NamedArgument): # "arg: 1" (185..191) - (name꞉ Identifier): "arg" # (185..188) - (colon꞉ Colon): ":" # (188..189) @@ -225,7 +225,7 @@ Tree: - (period꞉ Period): "." # (242..243) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "call" # (243..247) - (open_brace꞉ OpenBrace): "{" # (247..248) - - (arguments꞉ NamedArguments): # "arg: 1" (248..254) + - (arguments꞉ CallOptions): # "arg: 1" (248..254) - (item꞉ NamedArgument): # "arg: 1" (248..254) - (name꞉ Identifier): "arg" # (248..251) - (colon꞉ Colon): ":" # (251..252) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml index 55df439a43..dd6567d277 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml @@ -13,7 +13,7 @@ Tree: - (period꞉ Period): "." # (1..2) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "b" # (2..3) - (open_brace꞉ OpenBrace): "{" # (3..4) - - (arguments꞉ NamedArguments): # "value: 0, gas: 1" (4..20) + - (arguments꞉ CallOptions): # "value: 0, gas: 1" (4..20) - (item꞉ NamedArgument): # "value: 0" (4..12) - (name꞉ Identifier): "value" # (4..9) - (colon꞉ Colon): ":" # (9..10) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml index 5e96c47ed1..ecb6b10a10 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml @@ -14,7 +14,7 @@ Tree: - (period꞉ Period): "." # (1..2) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "b" # (2..3) - (open_brace꞉ OpenBrace): "{" # (3..4) - - (arguments꞉ NamedArguments): # "value: 0" (4..12) + - (arguments꞉ CallOptions): # "value: 0" (4..12) - (item꞉ NamedArgument): # "value: 0" (4..12) - (name꞉ Identifier): "value" # (4..9) - (colon꞉ Colon): ":" # (9..10) @@ -23,7 +23,7 @@ Tree: - (literal꞉ DecimalLiteral): "0" # (11..12) - (close_brace꞉ CloseBrace): "}" # (12..13) - (open_brace꞉ OpenBrace): "{" # (13..14) - - (arguments꞉ NamedArguments): # "gas: 1" (14..20) + - (arguments꞉ CallOptions): # "gas: 1" (14..20) - (item꞉ NamedArgument): # "gas: 1" (14..20) - (name꞉ Identifier): "gas" # (14..17) - (colon꞉ Colon): ":" # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_options/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_options/generated/0.6.2-success.yml index d113c07db7..abb42cd435 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_options/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_options/generated/0.6.2-success.yml @@ -12,7 +12,7 @@ Tree: - (period꞉ Period): "." # (3..4) - (member꞉ MemberAccess) ► (variant꞉ Identifier): "deposit" # (4..11) - (open_brace꞉ OpenBrace): "{" # (11..12) - - (arguments꞉ NamedArguments): # "value: 100" (12..22) + - (arguments꞉ CallOptions): # "value: 100" (12..22) - (item꞉ NamedArgument): # "value: 100" (12..22) - (name꞉ Identifier): "value" # (12..17) - (colon꞉ Colon): ":" # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/new_expression_options/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/new_expression_options/generated/0.6.2-success.yml index faa0bac85a..cd838d4607 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/new_expression_options/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/new_expression_options/generated/0.6.2-success.yml @@ -13,7 +13,7 @@ Tree: - (LeadingTrivia) ► (Whitespace): " " # (3..4) - (item꞉ Identifier): "Foo" # (4..7) - (open_brace꞉ OpenBrace): "{" # (7..8) - - (arguments꞉ NamedArguments): # "value: 10" (8..17) + - (arguments꞉ CallOptions): # "value: 10" (8..17) - (item꞉ NamedArgument): # "value: 10" (8..17) - (name꞉ Identifier): "value" # (8..13) - (colon꞉ Colon): ":" # (13..14) diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/paren_expression_options/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/paren_expression_options/generated/0.6.2-success.yml index 2ab7afcfee..359eac89ad 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/paren_expression_options/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/paren_expression_options/generated/0.6.2-success.yml @@ -19,7 +19,7 @@ Tree: - (item꞉ Identifier): "FooBar" # (6..12) - (close_paren꞉ CloseParen): ")" # (12..13) - (open_brace꞉ OpenBrace): "{" # (13..14) - - (arguments꞉ NamedArguments): # "value: 5" (14..22) + - (arguments꞉ CallOptions): # "value: 5" (14..22) - (item꞉ NamedArgument): # "value: 5" (14..22) - (name꞉ Identifier): "value" # (14..19) - (colon꞉ Colon): ":" # (19..20) diff --git a/crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/generated/0.4.11-success.yml new file mode 100644 index 0000000000..0d0dd12d8f --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/generated/0.4.11-success.yml @@ -0,0 +1,23 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ // Named arguments can be empty │ 0..31 + 2 │ someFunc({}) │ 32..44 + +Errors: [] + +Tree: + - (FunctionCallExpression): # "// Named arguments can be empty\nsomeFunc({})\n" (0..45) + - (operand꞉ Expression): # "// Named arguments can be empty\nsomeFunc" (0..40) + - (LeadingTrivia): # "// Named arguments can be empty\n" (0..32) + - (SingleLineComment): "// Named arguments can be empty" # (0..31) + - (EndOfLine): "\n" # (31..32) + - (variant꞉ Identifier): "someFunc" # (32..40) + - (arguments꞉ ArgumentsDeclaration) ► (variant꞉ NamedArgumentsDeclaration): # "({})\n" (40..45) + - (open_paren꞉ OpenParen): "(" # (40..41) + - (arguments꞉ NamedArgumentGroup): # "{}" (41..43) + - (open_brace꞉ OpenBrace): "{" # (41..42) + - (arguments꞉ NamedArguments): [] # (42..42) + - (close_brace꞉ CloseBrace): "}" # (42..43) + - (close_paren꞉ CloseParen): ")" # (43..44) + - (TrailingTrivia) ► (EndOfLine): "\n" # (44..45) diff --git a/crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/input.sol b/crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/input.sol new file mode 100644 index 0000000000..ce0d2324e1 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/FunctionCallExpression/empty_named_arguments/input.sol @@ -0,0 +1,2 @@ +// Named arguments can be empty +someFunc({}) diff --git a/crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/generated/0.6.2-success.yml index 7f4bc6c72d..2c9f1f0197 100644 --- a/crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/generated/0.6.2-success.yml @@ -22,7 +22,7 @@ Tree: - (close_paren꞉ CloseParen): ")" # (8..9) - (LeadingTrivia) ► (Whitespace): " " # (9..10) - (open_brace꞉ OpenBrace): "{" # (10..11) - - (arguments꞉ NamedArguments): # " x: 1" (11..16) + - (arguments꞉ CallOptions): # " x: 1" (11..16) - (item꞉ NamedArgument): # " x: 1" (11..16) - (LeadingTrivia) ► (Whitespace): " " # (11..12) - (name꞉ Identifier): "x" # (12..13)