diff --git a/crates/solidity/inputs/language/bindings/rules.msgb b/crates/solidity/inputs/language/bindings/rules.msgb index aeea92ddb4..1ece0782c4 100644 --- a/crates/solidity/inputs/language/bindings/rules.msgb +++ b/crates/solidity/inputs/language/bindings/rules.msgb @@ -179,9 +179,11 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i node @contract.def node @contract.members node @contract.type_members + node @contract.modifiers edge @contract.lexical_scope -> @contract.members edge @contract.lexical_scope -> @contract.type_members + edge @contract.lexical_scope -> @contract.modifiers } @contract [ContractDefinition @name name: [Identifier]] { @@ -192,13 +194,21 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @contract.def -> def ;; "instance" like access path - node type_def - attr (type_def) pop_symbol = "@typeof" + ;; we have two distinct paths: @typeof -> . for accesses to variables of the contract's type + ;; and () -> . for accesses through a `new` invocation node member attr (member) pop_symbol = "." + edge member -> @contract.members + + node type_def + attr (type_def) pop_symbol = "@typeof" edge def -> type_def edge type_def -> member - edge member -> @contract.members + + node call + attr (call) pop_symbol = "()" + edge def -> call + edge call -> member ;; "namespace" like access path node type_member @@ -214,9 +224,25 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i | [EventDefinition] | [ErrorDefinition] | [UserDefinedValueTypeDefinition] + | [FunctionDefinition] + | [StateVariableDefinition] + | [ModifierDefinition] + | [FallbackFunctionDefinition] + | [ReceiveFunctionDefinition] )] ]] { edge @member.lexical_scope -> @contract.lexical_scope +} + +@contract [ContractDefinition [ContractMembers + [ContractMember @member ( + [EnumDefinition] + | [StructDefinition] + | [EventDefinition] + | [ErrorDefinition] + | [UserDefinedValueTypeDefinition] + )] +]] { edge @contract.type_members -> @member.def } @@ -224,9 +250,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i [ContractMember @member ( [FunctionDefinition] | [StateVariableDefinition] + | [ModifierDefinition] )] ]] { - edge @member.lexical_scope -> @contract.lexical_scope edge @contract.lexical_scope -> @member.def } @@ -237,6 +263,12 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @contract.members -> @function.def } +@contract [ContractDefinition members: [ContractMembers + item: [ContractMember @modifier variant: [ModifierDefinition]] +]] { + edge @contract.modifiers -> @modifier.def +} + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Interfaces @@ -495,35 +527,35 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Function and parameter declarations +;;; Function, parameter declarations and modifiers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@param [Parameter] { +@param [Parameter @type_name [TypeName]] { node @param.lexical_scope node @param.def -} -@param [Parameter @type_name [TypeName]] { edge @type_name.type_ref -> @param.lexical_scope -} - -@param [Parameter @type_name [TypeName] @name [Identifier]] { - node def - attr (def) node_definition = @name - attr (def) definiens_node = @param - edge @param.def -> def + node @param.typeof + attr (@param.typeof) push_symbol = "@typeof" + edge @param.typeof -> @type_name.output +} - node typeof - attr (typeof) push_symbol = "@typeof" +@param [Parameter @name [Identifier]] { + attr (@param.def) node_definition = @name + attr (@param.def) definiens_node = @param - edge def -> typeof - edge typeof -> @type_name.output + edge @param.def -> @param.typeof } @params [ParametersDeclaration] { node @params.lexical_scope node @params.defs + + ;; This scope can be used to resolve named argument calls + node @params.names + attr (@params.names) pop_symbol = "@param_names" + edge @params.names -> @params.defs } @params [ParametersDeclaration [Parameters @param item: [Parameter]]] { @@ -537,11 +569,8 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @function [FunctionDefinition name: [FunctionName @name [Identifier]]] { - node def - attr (def) node_definition = @name - attr (def) definiens_node = @function - - edge @function.def -> def + attr (@function.def) node_definition = @name + attr (@function.def) definiens_node = @function } @function [FunctionDefinition @params parameters: [ParametersDeclaration]] { @@ -550,6 +579,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; Input parameters are available in the function scope edge @function.lexical_scope -> @params.defs attr (@function.lexical_scope -> @params.defs) precedence = 1 + + ;; Connect to paramaters for named argument resolution + edge @function.def -> @params.names } @function [FunctionDefinition returns: [ReturnsDeclaration @@ -562,11 +594,118 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i attr (@function.lexical_scope -> @return_params.defs) precedence = 1 } +;; Only functions that return a single value have an actual return type +;; since tuples are not actual types in Solidity +@function [FunctionDefinition returns: [ReturnsDeclaration + [ParametersDeclaration [Parameters . @param [Parameter] .]] +]] { + node call + attr (call) pop_symbol = "()" + + edge @function.def -> call + edge call -> @param.typeof +} + ;; Connect the function body's block lexical scope to the function @function [FunctionDefinition [FunctionBody @block [Block]]] { edge @block.lexical_scope -> @function.lexical_scope } +@function [FunctionDefinition [FunctionAttributes item: [FunctionAttribute + @modifier [ModifierInvocation] +]]] { + edge @modifier.lexical_scope -> @function.lexical_scope +} + +@modifier [ModifierInvocation @name [IdentifierPath]] { + node @modifier.lexical_scope + + edge @name.left -> @modifier.lexical_scope +} + +@modifier [ModifierInvocation @args [ArgumentsDeclaration]] { + edge @args.lexical_scope -> @modifier.lexical_scope +} + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Fallback and receive functions +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +@fallback [FallbackFunctionDefinition] { + node @fallback.lexical_scope +} + +@fallback [FallbackFunctionDefinition @params parameters: [ParametersDeclaration]] { + edge @params.lexical_scope -> @fallback.lexical_scope + + ;; Input parameters are available in the fallback function scope + edge @fallback.lexical_scope -> @params.defs + attr (@fallback.lexical_scope -> @params.defs) precedence = 1 +} + +@fallback [FallbackFunctionDefinition returns: [ReturnsDeclaration + @return_params [ParametersDeclaration] +]] { + edge @return_params.lexical_scope -> @fallback.lexical_scope + + ;; Return parameters are available in the fallback function scope + edge @fallback.lexical_scope -> @return_params.defs + attr (@fallback.lexical_scope -> @return_params.defs) precedence = 1 +} + +@fallback [FallbackFunctionDefinition [FunctionBody @block [Block]]] { + edge @block.lexical_scope -> @fallback.lexical_scope +} + +@fallback [FallbackFunctionDefinition [FallbackFunctionAttributes + item: [FallbackFunctionAttribute @modifier [ModifierInvocation]] +]] { + edge @modifier.lexical_scope -> @fallback.lexical_scope +} + +@receive [ReceiveFunctionDefinition] { + node @receive.lexical_scope +} + +@receive [ReceiveFunctionDefinition [FunctionBody @block [Block]]] { + edge @block.lexical_scope -> @receive.lexical_scope +} + +@receive [ReceiveFunctionDefinition [ReceiveFunctionAttributes + item: [ReceiveFunctionAttribute @modifier [ModifierInvocation]] +]] { + edge @modifier.lexical_scope -> @receive.lexical_scope +} + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Function modifiers +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +@modifier [ModifierDefinition + @name name: [Identifier] + body: [FunctionBody @body [Block]] +] { + node @modifier.def + node @modifier.lexical_scope + + node def + attr (def) node_definition = @name + attr (def) definiens_node = @modifier + + edge @modifier.def -> def + edge @body.lexical_scope -> @modifier.lexical_scope +} + +@modifier [ModifierDefinition @params [ParametersDeclaration]] { + edge @params.lexical_scope -> @modifier.lexical_scope + + ;; Input parameters are available in the modifier scope + edge @modifier.lexical_scope -> @params.defs + attr (@modifier.lexical_scope -> @params.defs) precedence = 1 +} + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Blocks and generic statements @@ -886,6 +1025,12 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @args.lexical_scope -> @stmt.lexical_scope } +[Statement [RevertStatement + @error_ident [IdentifierPath] + @args [ArgumentsDeclaration] +]] { + edge @args.refs -> @error_ident.right +} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -904,6 +1049,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ]] { edge @event_ident.left -> @stmt.lexical_scope edge @args.lexical_scope -> @stmt.lexical_scope + edge @args.refs -> @event_ident.right } ;;; Unchecked @@ -1042,17 +1188,34 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Event definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@event [EventDefinition] { +@event [EventDefinition @name name: [Identifier]] { node @event.lexical_scope node @event.def + + attr (@event.def) node_definition = @name + attr (@event.def) definiens_node = @event + + node @event.params + attr (@event.params) pop_symbol = "@param_names" + edge @event.def -> @event.params } -@event [EventDefinition @name name: [Identifier]] { +@event [EventDefinition [EventParametersDeclaration [EventParameters + [EventParameter @type_name type_name: [TypeName]] +]]] { + edge @type_name.type_ref -> @event.lexical_scope +} + +@event [EventDefinition [EventParametersDeclaration [EventParameters + @param [EventParameter + @name name: [Identifier] + ] +]]] { node def attr (def) node_definition = @name - attr (def) definiens_node = @event + attr (def) definiens_node = @param - edge @event.def -> def + edge @event.params -> def } @@ -1060,17 +1223,34 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Error definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@error [ErrorDefinition] { +@error [ErrorDefinition @name name: [Identifier]] { node @error.lexical_scope node @error.def + + attr (@error.def) node_definition = @name + attr (@error.def) definiens_node = @error + + node @error.params + attr (@error.params) pop_symbol = "@param_names" + edge @error.def -> @error.params } -@error [ErrorDefinition @name name: [Identifier]] { +@error [ErrorDefinition [ErrorParametersDeclaration [ErrorParameters + [ErrorParameter @type_name type_name: [TypeName]] +]]] { + edge @type_name.type_ref -> @error.lexical_scope +} + +@error [ErrorDefinition [ErrorParametersDeclaration [ErrorParameters + @param [ErrorParameter + @name name: [Identifier] + ] +]]] { node def attr (def) node_definition = @name - attr (def) definiens_node = @error + attr (def) definiens_node = @param - edge @error.def -> def + edge @error.params -> def } @@ -1176,11 +1356,21 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @type.type_ref -> @type_expr.lexical_scope } +;; New expressions + +@new_expr [Expression [NewExpression @type [TypeName]]] { + edge @type.type_ref -> @new_expr.lexical_scope + edge @new_expr.output -> @type.output +} + ;;; Function call expressions @args [ArgumentsDeclaration] { node @args.lexical_scope + + node @args.refs + attr (@args.refs) push_symbol = "@param_names" } @args [ArgumentsDeclaration [PositionalArgumentsDeclaration @@ -1194,18 +1384,38 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @value.lexical_scope -> @named_arg.lexical_scope - node ref - attr (ref) node_reference = @name + node @named_arg.ref + attr (@named_arg.ref) node_reference = @name } @args [ArgumentsDeclaration [NamedArgumentsDeclaration [NamedArgumentGroup [NamedArguments @argument [NamedArgument]]] ]] { edge @argument.lexical_scope -> @args.lexical_scope + edge @argument.ref -> @args.refs } -@funcall [Expression [FunctionCallExpression @args [ArgumentsDeclaration]]] { +@funcall [Expression [FunctionCallExpression + @operand [Expression] + @args [ArgumentsDeclaration] +]] { edge @args.lexical_scope -> @funcall.lexical_scope + + ;; Connect to the output of the function name to be able to resolve named arguments + edge @args.refs -> @operand.output + + node call + attr (call) push_symbol = "()" + + edge @funcall.output -> call + edge call -> @operand.output +} + + +;;; Call options + +@expr [Expression [CallOptionsExpression options: [CallOptions @named_arg [NamedArgument]]]] { + edge @named_arg.lexical_scope -> @expr.lexical_scope } diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs index 749e9ffbe3..127e39e49d 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs @@ -184,9 +184,11 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i node @contract.def node @contract.members node @contract.type_members + node @contract.modifiers edge @contract.lexical_scope -> @contract.members edge @contract.lexical_scope -> @contract.type_members + edge @contract.lexical_scope -> @contract.modifiers } @contract [ContractDefinition @name name: [Identifier]] { @@ -197,13 +199,21 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @contract.def -> def ;; "instance" like access path - node type_def - attr (type_def) pop_symbol = "@typeof" + ;; we have two distinct paths: @typeof -> . for accesses to variables of the contract's type + ;; and () -> . for accesses through a `new` invocation node member attr (member) pop_symbol = "." + edge member -> @contract.members + + node type_def + attr (type_def) pop_symbol = "@typeof" edge def -> type_def edge type_def -> member - edge member -> @contract.members + + node call + attr (call) pop_symbol = "()" + edge def -> call + edge call -> member ;; "namespace" like access path node type_member @@ -219,9 +229,25 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i | [EventDefinition] | [ErrorDefinition] | [UserDefinedValueTypeDefinition] + | [FunctionDefinition] + | [StateVariableDefinition] + | [ModifierDefinition] + | [FallbackFunctionDefinition] + | [ReceiveFunctionDefinition] )] ]] { edge @member.lexical_scope -> @contract.lexical_scope +} + +@contract [ContractDefinition [ContractMembers + [ContractMember @member ( + [EnumDefinition] + | [StructDefinition] + | [EventDefinition] + | [ErrorDefinition] + | [UserDefinedValueTypeDefinition] + )] +]] { edge @contract.type_members -> @member.def } @@ -229,9 +255,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i [ContractMember @member ( [FunctionDefinition] | [StateVariableDefinition] + | [ModifierDefinition] )] ]] { - edge @member.lexical_scope -> @contract.lexical_scope edge @contract.lexical_scope -> @member.def } @@ -242,6 +268,12 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @contract.members -> @function.def } +@contract [ContractDefinition members: [ContractMembers + item: [ContractMember @modifier variant: [ModifierDefinition]] +]] { + edge @contract.modifiers -> @modifier.def +} + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Interfaces @@ -500,35 +532,35 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Function and parameter declarations +;;; Function, parameter declarations and modifiers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@param [Parameter] { +@param [Parameter @type_name [TypeName]] { node @param.lexical_scope node @param.def -} -@param [Parameter @type_name [TypeName]] { edge @type_name.type_ref -> @param.lexical_scope -} - -@param [Parameter @type_name [TypeName] @name [Identifier]] { - node def - attr (def) node_definition = @name - attr (def) definiens_node = @param - edge @param.def -> def + node @param.typeof + attr (@param.typeof) push_symbol = "@typeof" + edge @param.typeof -> @type_name.output +} - node typeof - attr (typeof) push_symbol = "@typeof" +@param [Parameter @name [Identifier]] { + attr (@param.def) node_definition = @name + attr (@param.def) definiens_node = @param - edge def -> typeof - edge typeof -> @type_name.output + edge @param.def -> @param.typeof } @params [ParametersDeclaration] { node @params.lexical_scope node @params.defs + + ;; This scope can be used to resolve named argument calls + node @params.names + attr (@params.names) pop_symbol = "@param_names" + edge @params.names -> @params.defs } @params [ParametersDeclaration [Parameters @param item: [Parameter]]] { @@ -542,11 +574,8 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i } @function [FunctionDefinition name: [FunctionName @name [Identifier]]] { - node def - attr (def) node_definition = @name - attr (def) definiens_node = @function - - edge @function.def -> def + attr (@function.def) node_definition = @name + attr (@function.def) definiens_node = @function } @function [FunctionDefinition @params parameters: [ParametersDeclaration]] { @@ -555,6 +584,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;; Input parameters are available in the function scope edge @function.lexical_scope -> @params.defs attr (@function.lexical_scope -> @params.defs) precedence = 1 + + ;; Connect to paramaters for named argument resolution + edge @function.def -> @params.names } @function [FunctionDefinition returns: [ReturnsDeclaration @@ -567,11 +599,118 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i attr (@function.lexical_scope -> @return_params.defs) precedence = 1 } +;; Only functions that return a single value have an actual return type +;; since tuples are not actual types in Solidity +@function [FunctionDefinition returns: [ReturnsDeclaration + [ParametersDeclaration [Parameters . @param [Parameter] .]] +]] { + node call + attr (call) pop_symbol = "()" + + edge @function.def -> call + edge call -> @param.typeof +} + ;; Connect the function body's block lexical scope to the function @function [FunctionDefinition [FunctionBody @block [Block]]] { edge @block.lexical_scope -> @function.lexical_scope } +@function [FunctionDefinition [FunctionAttributes item: [FunctionAttribute + @modifier [ModifierInvocation] +]]] { + edge @modifier.lexical_scope -> @function.lexical_scope +} + +@modifier [ModifierInvocation @name [IdentifierPath]] { + node @modifier.lexical_scope + + edge @name.left -> @modifier.lexical_scope +} + +@modifier [ModifierInvocation @args [ArgumentsDeclaration]] { + edge @args.lexical_scope -> @modifier.lexical_scope +} + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Fallback and receive functions +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +@fallback [FallbackFunctionDefinition] { + node @fallback.lexical_scope +} + +@fallback [FallbackFunctionDefinition @params parameters: [ParametersDeclaration]] { + edge @params.lexical_scope -> @fallback.lexical_scope + + ;; Input parameters are available in the fallback function scope + edge @fallback.lexical_scope -> @params.defs + attr (@fallback.lexical_scope -> @params.defs) precedence = 1 +} + +@fallback [FallbackFunctionDefinition returns: [ReturnsDeclaration + @return_params [ParametersDeclaration] +]] { + edge @return_params.lexical_scope -> @fallback.lexical_scope + + ;; Return parameters are available in the fallback function scope + edge @fallback.lexical_scope -> @return_params.defs + attr (@fallback.lexical_scope -> @return_params.defs) precedence = 1 +} + +@fallback [FallbackFunctionDefinition [FunctionBody @block [Block]]] { + edge @block.lexical_scope -> @fallback.lexical_scope +} + +@fallback [FallbackFunctionDefinition [FallbackFunctionAttributes + item: [FallbackFunctionAttribute @modifier [ModifierInvocation]] +]] { + edge @modifier.lexical_scope -> @fallback.lexical_scope +} + +@receive [ReceiveFunctionDefinition] { + node @receive.lexical_scope +} + +@receive [ReceiveFunctionDefinition [FunctionBody @block [Block]]] { + edge @block.lexical_scope -> @receive.lexical_scope +} + +@receive [ReceiveFunctionDefinition [ReceiveFunctionAttributes + item: [ReceiveFunctionAttribute @modifier [ModifierInvocation]] +]] { + edge @modifier.lexical_scope -> @receive.lexical_scope +} + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Function modifiers +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +@modifier [ModifierDefinition + @name name: [Identifier] + body: [FunctionBody @body [Block]] +] { + node @modifier.def + node @modifier.lexical_scope + + node def + attr (def) node_definition = @name + attr (def) definiens_node = @modifier + + edge @modifier.def -> def + edge @body.lexical_scope -> @modifier.lexical_scope +} + +@modifier [ModifierDefinition @params [ParametersDeclaration]] { + edge @params.lexical_scope -> @modifier.lexical_scope + + ;; Input parameters are available in the modifier scope + edge @modifier.lexical_scope -> @params.defs + attr (@modifier.lexical_scope -> @params.defs) precedence = 1 +} + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Blocks and generic statements @@ -891,6 +1030,12 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @args.lexical_scope -> @stmt.lexical_scope } +[Statement [RevertStatement + @error_ident [IdentifierPath] + @args [ArgumentsDeclaration] +]] { + edge @args.refs -> @error_ident.right +} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -909,6 +1054,7 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ]] { edge @event_ident.left -> @stmt.lexical_scope edge @args.lexical_scope -> @stmt.lexical_scope + edge @args.refs -> @event_ident.right } ;;; Unchecked @@ -1047,17 +1193,34 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Event definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@event [EventDefinition] { +@event [EventDefinition @name name: [Identifier]] { node @event.lexical_scope node @event.def + + attr (@event.def) node_definition = @name + attr (@event.def) definiens_node = @event + + node @event.params + attr (@event.params) pop_symbol = "@param_names" + edge @event.def -> @event.params } -@event [EventDefinition @name name: [Identifier]] { +@event [EventDefinition [EventParametersDeclaration [EventParameters + [EventParameter @type_name type_name: [TypeName]] +]]] { + edge @type_name.type_ref -> @event.lexical_scope +} + +@event [EventDefinition [EventParametersDeclaration [EventParameters + @param [EventParameter + @name name: [Identifier] + ] +]]] { node def attr (def) node_definition = @name - attr (def) definiens_node = @event + attr (def) definiens_node = @param - edge @event.def -> def + edge @event.params -> def } @@ -1065,17 +1228,34 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i ;;; Error definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -@error [ErrorDefinition] { +@error [ErrorDefinition @name name: [Identifier]] { node @error.lexical_scope node @error.def + + attr (@error.def) node_definition = @name + attr (@error.def) definiens_node = @error + + node @error.params + attr (@error.params) pop_symbol = "@param_names" + edge @error.def -> @error.params } -@error [ErrorDefinition @name name: [Identifier]] { +@error [ErrorDefinition [ErrorParametersDeclaration [ErrorParameters + [ErrorParameter @type_name type_name: [TypeName]] +]]] { + edge @type_name.type_ref -> @error.lexical_scope +} + +@error [ErrorDefinition [ErrorParametersDeclaration [ErrorParameters + @param [ErrorParameter + @name name: [Identifier] + ] +]]] { node def attr (def) node_definition = @name - attr (def) definiens_node = @error + attr (def) definiens_node = @param - edge @error.def -> def + edge @error.params -> def } @@ -1181,11 +1361,21 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @type.type_ref -> @type_expr.lexical_scope } +;; New expressions + +@new_expr [Expression [NewExpression @type [TypeName]]] { + edge @type.type_ref -> @new_expr.lexical_scope + edge @new_expr.output -> @type.output +} + ;;; Function call expressions @args [ArgumentsDeclaration] { node @args.lexical_scope + + node @args.refs + attr (@args.refs) push_symbol = "@param_names" } @args [ArgumentsDeclaration [PositionalArgumentsDeclaration @@ -1199,18 +1389,38 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i edge @value.lexical_scope -> @named_arg.lexical_scope - node ref - attr (ref) node_reference = @name + node @named_arg.ref + attr (@named_arg.ref) node_reference = @name } @args [ArgumentsDeclaration [NamedArgumentsDeclaration [NamedArgumentGroup [NamedArguments @argument [NamedArgument]]] ]] { edge @argument.lexical_scope -> @args.lexical_scope + edge @argument.ref -> @args.refs } -@funcall [Expression [FunctionCallExpression @args [ArgumentsDeclaration]]] { +@funcall [Expression [FunctionCallExpression + @operand [Expression] + @args [ArgumentsDeclaration] +]] { edge @args.lexical_scope -> @funcall.lexical_scope + + ;; Connect to the output of the function name to be able to resolve named arguments + edge @args.refs -> @operand.output + + node call + attr (call) push_symbol = "()" + + edge @funcall.output -> call + edge call -> @operand.output +} + + +;;; Call options + +@expr [Expression [CallOptionsExpression options: [CallOptions @named_arg [NamedArgument]]]] { + edge @named_arg.lexical_scope -> @expr.lexical_scope } diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/control.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/control.rs index efab380e3a..79f1c04d03 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/control.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/control.rs @@ -9,11 +9,6 @@ fn do_while() -> Result<()> { run("control", "do_while") } -#[test] -fn emit_event() -> Result<()> { - run("control", "emit_event") -} - #[test] fn for_empty_init_or_cond() -> Result<()> { run("control", "for_empty_init_or_cond") @@ -39,11 +34,6 @@ fn return_stmt() -> Result<()> { run("control", "return_stmt") } -#[test] -fn revert_stmt() -> Result<()> { - run("control", "revert_stmt") -} - #[test] fn try_stmt() -> Result<()> { run("control", "try_stmt") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/errors.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/errors.rs new file mode 100644 index 0000000000..2cdd2feae0 --- /dev/null +++ b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/errors.rs @@ -0,0 +1,20 @@ +// This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +use anyhow::Result; + +use crate::bindings_assertions::runner::run; + +#[test] +fn named_args() -> Result<()> { + run("errors", "named_args") +} + +#[test] +fn revert_stmt() -> Result<()> { + run("errors", "revert_stmt") +} + +#[test] +fn typed_args() -> Result<()> { + run("errors", "typed_args") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/events.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/events.rs new file mode 100644 index 0000000000..07b975b280 --- /dev/null +++ b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/events.rs @@ -0,0 +1,20 @@ +// This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +use anyhow::Result; + +use crate::bindings_assertions::runner::run; + +#[test] +fn emit_stmt() -> Result<()> { + run("events", "emit_stmt") +} + +#[test] +fn named_args() -> Result<()> { + run("events", "named_args") +} + +#[test] +fn typed_args() -> Result<()> { + run("events", "typed_args") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs index 392d330bc8..fcd9acd7cf 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs @@ -9,11 +9,26 @@ fn basic() -> Result<()> { run("expressions", "basic") } +#[test] +fn call_options() -> Result<()> { + run("expressions", "call_options") +} + +#[test] +fn call_output() -> Result<()> { + run("expressions", "call_output") +} + #[test] fn function_call() -> Result<()> { run("expressions", "function_call") } +#[test] +fn new_output() -> Result<()> { + run("expressions", "new_output") +} + #[test] fn type_expression() -> Result<()> { run("expressions", "type_expression") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs index 2505200544..b4fb7405f4 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs @@ -5,6 +5,8 @@ mod constants; mod contracts; mod control; mod enums; +mod errors; +mod events; mod expressions; mod function_types; mod functions; diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs index 570c26627f..7774026270 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn fallback_receive() -> Result<()> { + run("contracts", "fallback_receive") +} + #[test] fn visibility() -> Result<()> { run("contracts", "visibility") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/errors.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/errors.rs new file mode 100644 index 0000000000..7725da2d61 --- /dev/null +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/errors.rs @@ -0,0 +1,10 @@ +// This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +use anyhow::Result; + +use crate::bindings_output::runner::run; + +#[test] +fn custom_types() -> Result<()> { + run("errors", "custom_types") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/events.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/events.rs new file mode 100644 index 0000000000..5e8a63f2a5 --- /dev/null +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/events.rs @@ -0,0 +1,10 @@ +// This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +use anyhow::Result; + +use crate::bindings_output::runner::run; + +#[test] +fn custom_types() -> Result<()> { + run("events", "custom_types") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs index ca0961dd6a..e13cdcdb8c 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn emit_named_args() -> Result<()> { + run("expressions", "emit_named_args") +} + #[test] fn funcalls() -> Result<()> { run("expressions", "funcalls") @@ -14,6 +19,21 @@ fn funcalls_named_args() -> Result<()> { run("expressions", "funcalls_named_args") } +#[test] +fn funcalls_output() -> Result<()> { + run("expressions", "funcalls_output") +} + +#[test] +fn new_output() -> Result<()> { + run("expressions", "new_output") +} + +#[test] +fn revert_named_args() -> Result<()> { + run("expressions", "revert_named_args") +} + #[test] fn type_expr() -> Result<()> { run("expressions", "type_expr") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs index aa7ea4bfda..40ad07613e 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs @@ -3,11 +3,14 @@ mod contracts; mod control; mod enums; +mod errors; +mod events; mod expressions; mod imports; mod interfaces; mod libraries; mod mappings; +mod modifiers; mod structs; mod variables; mod yul; diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/modifiers.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/modifiers.rs new file mode 100644 index 0000000000..81fff76ce1 --- /dev/null +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/modifiers.rs @@ -0,0 +1,15 @@ +// This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +use anyhow::Result; + +use crate::bindings_output::runner::run; + +#[test] +fn simple() -> Result<()> { + run("modifiers", "simple") +} + +#[test] +fn with_args() -> Result<()> { + run("modifiers", "with_args") +} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/errors/named_args.sol b/crates/solidity/testing/snapshots/bindings_assertions/errors/named_args.sol new file mode 100644 index 0000000000..4258aa3142 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_assertions/errors/named_args.sol @@ -0,0 +1,16 @@ +contract Test { + enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } + // ^def:3 + error Failure ( + Cause cause, + // ^def:1 + string details + // ^def:2 + ); + function test() public { + revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + // ^ref:1 (>= 0.8.4) + // ^ref:3 (>= 0.8.4) + // ^ref:2 (>= 0.8.4) + } +} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/control/revert_stmt.sol b/crates/solidity/testing/snapshots/bindings_assertions/errors/revert_stmt.sol similarity index 100% rename from crates/solidity/testing/snapshots/bindings_assertions/control/revert_stmt.sol rename to crates/solidity/testing/snapshots/bindings_assertions/errors/revert_stmt.sol diff --git a/crates/solidity/testing/snapshots/bindings_assertions/errors/typed_args.sol b/crates/solidity/testing/snapshots/bindings_assertions/errors/typed_args.sol new file mode 100644 index 0000000000..e4ed8b8c0f --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_assertions/errors/typed_args.sol @@ -0,0 +1,21 @@ +contract Test { + enum Cause { + //^def:1 + InsuficientFunds, + NotAuthorized, + //= 0.8.4) + // ^ref:1 (>= 0.8.4) + // ^ref:3 (>= 0.8.4) + } +} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/control/emit_event.sol b/crates/solidity/testing/snapshots/bindings_assertions/events/emit_stmt.sol similarity index 100% rename from crates/solidity/testing/snapshots/bindings_assertions/control/emit_event.sol rename to crates/solidity/testing/snapshots/bindings_assertions/events/emit_stmt.sol diff --git a/crates/solidity/testing/snapshots/bindings_assertions/events/named_args.sol b/crates/solidity/testing/snapshots/bindings_assertions/events/named_args.sol new file mode 100644 index 0000000000..d50ec37a5f --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_assertions/events/named_args.sol @@ -0,0 +1,18 @@ +contract Test { + enum Severity { Info, Error } + // ^def:3 + + event Log ( + Severity level, + // ^def:1 + string message + // ^def:2 + ); + + function test() { + emit Log({message: "testing", level: Severity.Info}); + // ^ref:3 (>= 0.4.21) + // ^ref:1 (>= 0.4.21) + // ^ref:2 (>= 0.4.21) + } +} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/events/typed_args.sol b/crates/solidity/testing/snapshots/bindings_assertions/events/typed_args.sol new file mode 100644 index 0000000000..af8d1f0ecb --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_assertions/events/typed_args.sol @@ -0,0 +1,22 @@ +contract Test { + enum Severity { + //^def:1 + Info, + //= 0.4.21) + // ^ref:1 (>= 0.4.21) + // ^ref:2 (>= 0.4.21) + } +} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_options.sol b/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_options.sol new file mode 100644 index 0000000000..6f724db9cb --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_options.sol @@ -0,0 +1,23 @@ +interface External { + function sample(uint x) external payable returns (uint); + // ^def:5 +} + +contract Test { + External ext; + // ^def:4 + function test(uint x) public returns (uint) { + // ^def:1 + uint v = 10; + // ^def:2 + uint g = 800; + // ^def:3 + + return ext.sample{ value: v, gas: g }(x); + // ^ref:1 (>= 0.6.2) + // ^ref:3 (>= 0.6.2) + // ^ref:2 (>= 0.6.2) + // ^ref:5 + // ^ref:4 + } +} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_output.sol b/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_output.sol new file mode 100644 index 0000000000..7bb655b6c8 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_output.sol @@ -0,0 +1,17 @@ +contract Test { + struct Resource { + uint value; + // ^def:1 + } + + function test_call_output() public returns (uint) { + return get_resource().value; + // ^ref:1 + // ^ref:2 + } + + function get_resource() internal returns (Resource memory) { + // ^def:2 + return Resource(1); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/expressions/new_output.sol b/crates/solidity/testing/snapshots/bindings_assertions/expressions/new_output.sol new file mode 100644 index 0000000000..380cc09b63 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_assertions/expressions/new_output.sol @@ -0,0 +1,19 @@ +contract Test { + function test_new_output() public returns (uint) { + return new Container().cell().value; + // ^ref:2 + // ^ref:3 + // ^ref:1 + } +} + +contract Container { + // ^def:1 + struct Resource { + uint value; + // ^def:2 + } + + function cell() public returns (Resource memory) { return Resource(1); } + // ^def:3 +} diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..fe89573509 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/generated/0.4.11-failure.txt @@ -0,0 +1,33 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ConstantKeyword or Identifier or InternalKeyword or PrivateKeyword or PublicKeyword. + ╭─[input.sol:5:13] + │ + 5 │ ╭─▶ fallback(bytes calldata input) external payable returns (bytes memory output) { + ┆ ┆ + 12 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Fallback { + │ ────┬─── + │ ╰───── def: 1 + 2 │ event Log(string func, uint256 gas); + │ ─┬─ ──┬─ ─┬─ + │ ╰──────────────────────────── def: 2 + │ │ │ + │ ╰──────────────── def: 3 + │ │ + │ ╰─── def: 4 + 3 │ uint status; + │ ───┬── + │ ╰──── def: 5 + │ + 5 │ fallback(bytes calldata input) external payable returns (bytes memory output) { + │ ────┬─── + │ ╰───── unresolved +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/generated/0.6.0-success.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/generated/0.6.0-success.txt new file mode 100644 index 0000000000..f0f534b967 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/generated/0.6.0-success.txt @@ -0,0 +1,41 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Fallback { + │ ────┬─── + │ ╰───── def: 1 + 2 │ event Log(string func, uint256 gas); + │ ─┬─ ──┬─ ─┬─ + │ ╰──────────────────────────── def: 2 + │ │ │ + │ ╰──────────────── def: 3 + │ │ + │ ╰─── def: 4 + 3 │ uint status; + │ ───┬── + │ ╰──── def: 5 + │ + 5 │ fallback(bytes calldata input) external payable returns (bytes memory output) { + │ ──┬── ───┬── + │ ╰─────────────────────────────────────────────────── def: 6 + │ │ + │ ╰──── def: 7 + 6 │ emit Log("fallback", status); + │ ─┬─ ───┬── + │ ╰────────────────────── ref: 2 + │ │ + │ ╰──── ref: 5 + 7 │ output = input; + │ ───┬── ──┬── + │ ╰──────────── ref: 7 + │ │ + │ ╰──── ref: 6 + │ + 11 │ emit Log("receive", status); + │ ─┬─ ───┬── + │ ╰───────────────────── ref: 2 + │ │ + │ ╰──── ref: 5 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/input.sol b/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/input.sol new file mode 100644 index 0000000000..8592b03d04 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/fallback_receive/input.sol @@ -0,0 +1,13 @@ +contract Fallback { + event Log(string func, uint256 gas); + uint status; + + fallback(bytes calldata input) external payable returns (bytes memory output) { + emit Log("fallback", status); + output = input; + } + + receive() external payable { + emit Log("receive", status); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.11-failure.txt index 2b5a354b96..953a9212d2 100644 --- a/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.11-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.11-failure.txt @@ -15,19 +15,21 @@ References and definitions: │ ──┬─ │ ╰─── def: 1 2 │ event TestEvent(int id); - │ ────┬──── - │ ╰────── def: 2 + │ ────┬──── ─┬ + │ ╰───────────── def: 2 + │ │ + │ ╰── def: 3 │ 4 │ function test_emit() public { │ ────┬──── - │ ╰────── def: 3 + │ ╰────── def: 4 5 │ int x = 1; │ ┬ - │ ╰── def: 4 + │ ╰── def: 5 │ 7 │ emit TestEvent(x); │ ──┬─ ────┬──── │ ╰───────────── unresolved │ │ - │ ╰────── def: 5 + │ ╰────── def: 6 ───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.21-success.txt b/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.21-success.txt index 43d4a26bde..68ef83be3c 100644 --- a/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.21-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/control/emit_event/generated/0.4.21-success.txt @@ -7,19 +7,21 @@ References and definitions: │ ──┬─ │ ╰─── def: 1 2 │ event TestEvent(int id); - │ ────┬──── - │ ╰────── def: 2 + │ ────┬──── ─┬ + │ ╰───────────── def: 2 + │ │ + │ ╰── def: 3 │ 4 │ function test_emit() public { │ ────┬──── - │ ╰────── def: 3 + │ ╰────── def: 4 5 │ int x = 1; │ ┬ - │ ╰── def: 4 + │ ╰── def: 5 │ 7 │ emit TestEvent(x); │ ────┬──── ┬ │ ╰──────── ref: 2 │ │ - │ ╰── ref: 4 + │ ╰── ref: 5 ───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..9cf0d8c365 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/generated/0.4.11-failure.txt @@ -0,0 +1,50 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:7:18] + │ + 7 │ ╭─▶ error Failure( + ┆ ┆ + 10 │ ├─▶ ); + │ │ + │ ╰──────────── Error occurred here. +────╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:13:23] + │ + 13 │ revert Failure(Severity.ERROR, "Testing"); + │ ─────────────┬───────────── + │ ╰─────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ enum Severity { + │ ────┬─── + │ ╰───── def: 2 + 3 │ INFO, + │ ──┬─ + │ ╰─── def: 3 + 4 │ ERROR + │ ──┬── + │ ╰──── def: 4 + │ + 7 │ error Failure( + │ ──┬── ───┬─── + │ ╰──────────── unresolved + │ │ + │ ╰───── def: 5 + │ + 12 │ function test() public { + │ ──┬─ + │ ╰─── def: 6 + 13 │ revert Failure(Severity.ERROR, "Testing"); + │ ───┬── ───┬─── + │ ╰──────────── unresolved + │ │ + │ ╰───── def: 7 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/generated/0.8.4-success.txt b/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/generated/0.8.4-success.txt new file mode 100644 index 0000000000..6e9ba9c5d7 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/generated/0.8.4-success.txt @@ -0,0 +1,41 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ enum Severity { + │ ────┬─── + │ ╰───── def: 2 + 3 │ INFO, + │ ──┬─ + │ ╰─── def: 3 + 4 │ ERROR + │ ──┬── + │ ╰──── def: 4 + │ + 7 │ error Failure( + │ ───┬─── + │ ╰───── def: 5 + 8 │ Severity severity, + │ ────┬─── ────┬─── + │ ╰────────────── ref: 2 + │ │ + │ ╰───── def: 6 + 9 │ string cause + │ ──┬── + │ ╰──── def: 7 + │ + 12 │ function test() public { + │ ──┬─ + │ ╰─── def: 8 + 13 │ revert Failure(Severity.ERROR, "Testing"); + │ ───┬─── ────┬─── ──┬── + │ ╰──────────────────── ref: 5 + │ │ │ + │ ╰─────────── ref: 2 + │ │ + │ ╰──── ref: 4 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/input.sol b/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/input.sol new file mode 100644 index 0000000000..52077ea009 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/custom_types/input.sol @@ -0,0 +1,15 @@ +contract Test { + enum Severity { + INFO, + ERROR + } + + error Failure( + Severity severity, + string cause + ); + + function test() public { + revert Failure(Severity.ERROR, "Testing"); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/events/custom_types/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/events/custom_types/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..4ccebb12de --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/custom_types/generated/0.4.11-failure.txt @@ -0,0 +1,47 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:13:17] + │ + 13 │ emit Log(Severity.INFO, "Testing"); + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ enum Severity { + │ ────┬─── + │ ╰───── def: 2 + 3 │ INFO, + │ ──┬─ + │ ╰─── def: 3 + 4 │ ERROR + │ ──┬── + │ ╰──── def: 4 + │ + 7 │ event Log( + │ ─┬─ + │ ╰─── def: 5 + 8 │ Severity level, + │ ────┬─── ──┬── + │ ╰─────────── ref: 2 + │ │ + │ ╰──── def: 6 + 9 │ string name + │ ──┬─ + │ ╰─── def: 7 + │ + 12 │ function test() public { + │ ──┬─ + │ ╰─── def: 8 + 13 │ emit Log(Severity.INFO, "Testing"); + │ ──┬─ ─┬─ + │ ╰─────── unresolved + │ │ + │ ╰─── def: 9 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/events/custom_types/generated/0.4.21-success.txt b/crates/solidity/testing/snapshots/bindings_output/events/custom_types/generated/0.4.21-success.txt new file mode 100644 index 0000000000..941335c856 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/custom_types/generated/0.4.21-success.txt @@ -0,0 +1,41 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ enum Severity { + │ ────┬─── + │ ╰───── def: 2 + 3 │ INFO, + │ ──┬─ + │ ╰─── def: 3 + 4 │ ERROR + │ ──┬── + │ ╰──── def: 4 + │ + 7 │ event Log( + │ ─┬─ + │ ╰─── def: 5 + 8 │ Severity level, + │ ────┬─── ──┬── + │ ╰─────────── ref: 2 + │ │ + │ ╰──── def: 6 + 9 │ string name + │ ──┬─ + │ ╰─── def: 7 + │ + 12 │ function test() public { + │ ──┬─ + │ ╰─── def: 8 + 13 │ emit Log(Severity.INFO, "Testing"); + │ ─┬─ ────┬─── ──┬─ + │ ╰───────────────── ref: 5 + │ │ │ + │ ╰────────── ref: 2 + │ │ + │ ╰─── ref: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/events/custom_types/input.sol b/crates/solidity/testing/snapshots/bindings_output/events/custom_types/input.sol new file mode 100644 index 0000000000..a7908824c8 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/custom_types/input.sol @@ -0,0 +1,15 @@ +contract Test { + enum Severity { + INFO, + ERROR + } + + event Log( + Severity level, + string name + ); + + function test() public { + emit Log(Severity.INFO, "Testing"); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..2b8c8f6984 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/generated/0.4.11-failure.txt @@ -0,0 +1,35 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:8:17] + │ + 8 │ emit Log({level: 1, name: "Testing"}); + │ ──────────────┬────────────── + │ ╰──────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ event Log( + │ ─┬─ + │ ╰─── def: 2 + 3 │ string name, + │ ──┬─ + │ ╰─── def: 3 + 4 │ uint level + │ ──┬── + │ ╰──── def: 4 + │ + 7 │ function test() public { + │ ──┬─ + │ ╰─── def: 5 + 8 │ emit Log({level: 1, name: "Testing"}); + │ ──┬─ ─┬─ + │ ╰─────── unresolved + │ │ + │ ╰─── def: 6 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/generated/0.4.21-success.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/generated/0.4.21-success.txt new file mode 100644 index 0000000000..95980e7b10 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/generated/0.4.21-success.txt @@ -0,0 +1,29 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ event Log( + │ ─┬─ + │ ╰─── def: 2 + 3 │ string name, + │ ──┬─ + │ ╰─── def: 3 + 4 │ uint level + │ ──┬── + │ ╰──── def: 4 + │ + 7 │ function test() public { + │ ──┬─ + │ ╰─── def: 5 + 8 │ emit Log({level: 1, name: "Testing"}); + │ ─┬─ ──┬── ──┬─ + │ ╰─────────────────── ref: 2 + │ │ │ + │ ╰───────────── ref: 4 + │ │ + │ ╰─── ref: 3 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/input.sol b/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/input.sol new file mode 100644 index 0000000000..b7fbf0de0e --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/emit_named_args/input.sol @@ -0,0 +1,10 @@ +contract Test { + event Log( + string name, + uint level + ); + + function test() public { + emit Log({level: 1, name: "Testing"}); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_named_args/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_named_args/generated/0.4.11-success.txt index 41f62c2608..40c643b280 100644 --- a/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_named_args/generated/0.4.11-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_named_args/generated/0.4.11-success.txt @@ -15,11 +15,11 @@ References and definitions: │ ───┬── ────┬─── ┬ ───┬─── │ ╰─────────────────────────── ref: 4 │ │ │ │ - │ ╰───────────────── unresolved + │ ╰───────────────── ref: 5 │ │ │ │ ╰─────────── ref: 3 │ │ - │ ╰───── unresolved + │ ╰───── ref: 6 │ 5 │ function divide(int dividend, int divisor) returns (int); │ ───┬── ────┬─── ───┬─── diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_output/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_output/generated/0.4.11-success.txt new file mode 100644 index 0000000000..ca70e365b9 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_output/generated/0.4.11-success.txt @@ -0,0 +1,38 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ function test_call() public returns (uint) { + │ ────┬──── + │ ╰────── def: 2 + 3 │ return Utils.create().value; + │ ──┬── ───┬── ──┬── + │ ╰─────────────────── ref: 3 + │ │ │ + │ ╰──────────── ref: 6 + │ │ + │ ╰──── ref: 5 + │ + 7 │ library Utils { + │ ──┬── + │ ╰──── def: 3 + 8 │ struct Resource { + │ ────┬─── + │ ╰───── def: 4 + 9 │ uint value; + │ ──┬── + │ ╰──── def: 5 + │ + 12 │ function create() public returns (Resource memory) { + │ ───┬── ────┬─── + │ ╰─────────────────────────────── def: 6 + │ │ + │ ╰───── ref: 4 + 13 │ return Resource(1); + │ ────┬─── + │ ╰───── ref: 4 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_output/input.sol b/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_output/input.sol new file mode 100644 index 0000000000..1f25aaec79 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/funcalls_output/input.sol @@ -0,0 +1,15 @@ +contract Test { + function test_call() public returns (uint) { + return Utils.create().value; + } +} + +library Utils { + struct Resource { + uint value; + } + + function create() public returns (Resource memory) { + return Resource(1); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/new_output/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/new_output/generated/0.4.11-success.txt new file mode 100644 index 0000000000..3131836a34 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/new_output/generated/0.4.11-success.txt @@ -0,0 +1,38 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ function test_new() public returns (uint) { + │ ────┬─── + │ ╰───── def: 2 + 3 │ return new Container().cell().value; + │ ────┬──── ──┬─ ──┬── + │ ╰───────────────────── ref: 3 + │ │ │ + │ ╰─────────── ref: 6 + │ │ + │ ╰──── ref: 5 + │ + 7 │ contract Container { + │ ────┬──── + │ ╰────── def: 3 + 8 │ struct Resource { + │ ────┬─── + │ ╰───── def: 4 + 9 │ uint value; + │ ──┬── + │ ╰──── def: 5 + │ + 12 │ function cell() public returns (Resource memory) { + │ ──┬─ ────┬─── + │ ╰────────────────────────────── def: 6 + │ │ + │ ╰───── ref: 4 + 13 │ return Resource(1); + │ ────┬─── + │ ╰───── ref: 4 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/new_output/input.sol b/crates/solidity/testing/snapshots/bindings_output/expressions/new_output/input.sol new file mode 100644 index 0000000000..cfdd01bed7 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/new_output/input.sol @@ -0,0 +1,15 @@ +contract Test { + function test_new() public returns (uint) { + return new Container().cell().value; + } +} + +contract Container { + struct Resource { + uint value; + } + + function cell() public returns (Resource memory) { + return Resource(1); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..4fbb44b584 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/generated/0.4.11-failure.txt @@ -0,0 +1,40 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:2:18] + │ + 2 │ ╭─▶ error Failure( + ┆ ┆ + 5 │ ├─▶ ); + │ │ + │ ╰──────────── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:8:23] + │ + 8 │ revert Failure({severity: 100, cause: "Testing"}); + │ ─────────────────┬───────────────── + │ ╰─────────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ error Failure( + │ ──┬── ───┬─── + │ ╰──────────── unresolved + │ │ + │ ╰───── def: 2 + │ + 7 │ function test() public { + │ ──┬─ + │ ╰─── def: 3 + 8 │ revert Failure({severity: 100, cause: "Testing"}); + │ ───┬── ───┬─── + │ ╰──────────── unresolved + │ │ + │ ╰───── def: 4 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/generated/0.8.4-success.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/generated/0.8.4-success.txt new file mode 100644 index 0000000000..38585417c4 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/generated/0.8.4-success.txt @@ -0,0 +1,29 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── def: 1 + 2 │ error Failure( + │ ───┬─── + │ ╰───── def: 2 + 3 │ uint severity, + │ ────┬─── + │ ╰───── def: 3 + 4 │ string cause + │ ──┬── + │ ╰──── def: 4 + │ + 7 │ function test() public { + │ ──┬─ + │ ╰─── def: 5 + 8 │ revert Failure({severity: 100, cause: "Testing"}); + │ ───┬─── ────┬─── ──┬── + │ ╰─────────────────────────── ref: 2 + │ │ │ + │ ╰───────────────── ref: 3 + │ │ + │ ╰──── ref: 4 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/input.sol b/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/input.sol new file mode 100644 index 0000000000..9c53beba4b --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/revert_named_args/input.sol @@ -0,0 +1,10 @@ +contract Test { + error Failure( + uint severity, + string cause + ); + + function test() public { + revert Failure({severity: 100, cause: "Testing"}); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/modifiers/simple/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/modifiers/simple/generated/0.4.11-success.txt new file mode 100644 index 0000000000..c82d36bf65 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/modifiers/simple/generated/0.4.11-success.txt @@ -0,0 +1,37 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract FunctionModifier { + │ ────────┬─────── + │ ╰───────── def: 1 + 2 │ bool public locked; + │ ───┬── + │ ╰──── def: 2 + │ + 4 │ modifier noReentrancy() { + │ ──────┬───── + │ ╰─────── def: 3 + 5 │ require(!locked, "No reentrancy"); + │ ───┬─── ───┬── + │ ╰───────────── unresolved + │ │ + │ ╰──── ref: 2 + │ + 7 │ locked = true; + │ ───┬── + │ ╰──── ref: 2 + 8 │ _; + │ ┬ + │ ╰── unresolved + 9 │ locked = false; + │ ───┬── + │ ╰──── ref: 2 + │ + 12 │ function decrement() public noReentrancy { + │ ────┬──── ──────┬───── + │ ╰──────────────────────────── def: 4 + │ │ + │ ╰─────── ref: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/modifiers/simple/input.sol b/crates/solidity/testing/snapshots/bindings_output/modifiers/simple/input.sol new file mode 100644 index 0000000000..cebc39b0d6 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/modifiers/simple/input.sol @@ -0,0 +1,15 @@ +contract FunctionModifier { + bool public locked; + + modifier noReentrancy() { + require(!locked, "No reentrancy"); + + locked = true; + _; + locked = false; + } + + function decrement() public noReentrancy { + // ... + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/modifiers/with_args/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/modifiers/with_args/generated/0.4.11-success.txt new file mode 100644 index 0000000000..7f485928de --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/modifiers/with_args/generated/0.4.11-success.txt @@ -0,0 +1,44 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract FunctionModifier { + │ ────────┬─────── + │ ╰───────── def: 1 + 2 │ address public owner; + │ ──┬── + │ ╰──── def: 2 + │ + 4 │ modifier validAddress(address _addr) { + │ ──────┬───── ──┬── + │ ╰───────────────────── def: 3 + │ │ + │ ╰──── def: 4 + 5 │ require(_addr != address(0), "Not valid address"); + │ ───┬─── ──┬── + │ ╰─────────── unresolved + │ │ + │ ╰──── ref: 4 + 6 │ _; + │ ┬ + │ ╰── unresolved + │ + 9 │ function changeOwner(address _newOwner) + │ ─────┬───── ────┬──── + │ ╰───────────────────────── def: 5 + │ │ + │ ╰────── def: 6 + │ + 11 │ validAddress(_newOwner) + │ ──────┬───── ────┬──── + │ ╰───────────────── ref: 3 + │ │ + │ ╰────── ref: 6 + │ + 13 │ owner = _newOwner; + │ ──┬── ────┬──── + │ ╰──────────────── ref: 2 + │ │ + │ ╰────── ref: 6 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/modifiers/with_args/input.sol b/crates/solidity/testing/snapshots/bindings_output/modifiers/with_args/input.sol new file mode 100644 index 0000000000..76bd428b7b --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/modifiers/with_args/input.sol @@ -0,0 +1,15 @@ +contract FunctionModifier { + address public owner; + + modifier validAddress(address _addr) { + require(_addr != address(0), "Not valid address"); + _; + } + + function changeOwner(address _newOwner) + public + validAddress(_newOwner) + { + owner = _newOwner; + } +}