diff --git a/slither/solc_parsing/expressions/expression_parsing.py b/slither/solc_parsing/expressions/expression_parsing.py index 0f319b104..9e3a12b06 100644 --- a/slither/solc_parsing/expressions/expression_parsing.py +++ b/slither/solc_parsing/expressions/expression_parsing.py @@ -643,7 +643,9 @@ def parse_expression(expression: Dict, caller_context: CallerContextExpression) else: referenced_declaration = None - var, was_created = find_variable(value, caller_context, referenced_declaration) + var, was_created = find_variable( + value, caller_context, referenced_declaration, is_identifier_path=True + ) if was_created: var.set_offset(src, caller_context.compilation_unit) diff --git a/slither/solc_parsing/expressions/find_variable.py b/slither/solc_parsing/expressions/find_variable.py index 33c342097..200e14a41 100644 --- a/slither/solc_parsing/expressions/find_variable.py +++ b/slither/solc_parsing/expressions/find_variable.py @@ -155,6 +155,7 @@ def _find_in_contract( contract: Optional[Contract], contract_declarer: Optional[Contract], is_super: bool, + is_identifier_path: bool = False, ) -> Optional[Union[Variable, Function, Contract, Event, Enum, Structure, CustomError]]: if contract is None or contract_declarer is None: return None @@ -197,6 +198,13 @@ def _find_in_contract( if var_name in modifiers: return modifiers[var_name] + if is_identifier_path: + for sig, modifier in modifiers.items(): + if "(" in sig: + sig = sig[0 : sig.find("(")] + if sig == var_name: + return modifier + # structures are looked on the contract declarer structures = contract.structures_as_dict if var_name in structures: @@ -294,6 +302,7 @@ def find_variable( caller_context: CallerContextExpression, referenced_declaration: Optional[int] = None, is_super: bool = False, + is_identifier_path: bool = False, ) -> Tuple[ Union[ Variable, @@ -321,6 +330,8 @@ def find_variable( :type referenced_declaration: :param is_super: :type is_super: + :param is_identifier_path: + :type is_identifier_path: :return: :rtype: """ @@ -381,7 +392,7 @@ def find_variable( else: assert isinstance(underlying_func, FunctionTopLevel) - ret = _find_in_contract(var_name, contract, contract_declarer, is_super) + ret = _find_in_contract(var_name, contract, contract_declarer, is_super, is_identifier_path) if ret: return ret, False diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.0-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.0-compact.zip new file mode 100644 index 000000000..f8a3c1a16 Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.0-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.1-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.1-compact.zip new file mode 100644 index 000000000..cdb2a9daa Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.1-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.10-compact.zip new file mode 100644 index 000000000..5fb6cde6b Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.11-compact.zip new file mode 100644 index 000000000..adf9a336a Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.12-compact.zip new file mode 100644 index 000000000..7e6e7a65f Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.13-compact.zip new file mode 100644 index 000000000..47066aa8b Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.14-compact.zip new file mode 100644 index 000000000..01de606fb Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.15-compact.zip new file mode 100644 index 000000000..233e4a87f Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.2-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.2-compact.zip new file mode 100644 index 000000000..b5fea85ed Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.2-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.3-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.3-compact.zip new file mode 100644 index 000000000..728beb81f Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.3-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.4-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.4-compact.zip new file mode 100644 index 000000000..1eb88493e Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.4-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.5-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.5-compact.zip new file mode 100644 index 000000000..316ec5863 Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.5-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.6-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.6-compact.zip new file mode 100644 index 000000000..6fd91e0e7 Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.6-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.7-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.7-compact.zip new file mode 100644 index 000000000..041c5ea9e Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.7-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.8-compact.zip new file mode 100644 index 000000000..c132ab79a Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.9-compact.zip b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.9-compact.zip new file mode 100644 index 000000000..1a06a3c57 Binary files /dev/null and b/tests/ast-parsing/compile/modifier_identifier_path.sol-0.8.9-compact.zip differ diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.0-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.0-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.0-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.1-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.1-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.1-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.10-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.10-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.10-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.11-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.11-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.11-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.12-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.12-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.12-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.13-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.13-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.13-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.14-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.14-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.14-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.15-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.15-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.15-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.2-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.2-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.2-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.3-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.3-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.3-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.4-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.4-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.4-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.5-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.5-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.5-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.6-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.6-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.6-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.7-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.7-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.7-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.8-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.8-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.8-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.9-compact.json b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.9-compact.json new file mode 100644 index 000000000..5b48c6fdf --- /dev/null +++ b/tests/ast-parsing/expected/modifier_identifier_path.sol-0.8.9-compact.json @@ -0,0 +1,10 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "m()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/modifier_identifier_path.sol b/tests/ast-parsing/modifier_identifier_path.sol new file mode 100644 index 000000000..196de8d61 --- /dev/null +++ b/tests/ast-parsing/modifier_identifier_path.sol @@ -0,0 +1,12 @@ +contract A{ + + function f() public m {} + modifier m()virtual {_;} + +} + +contract B is A{ + + modifier m() override {_;} + +} diff --git a/tests/test_ast_parsing.py b/tests/test_ast_parsing.py index b3114ca40..005971374 100644 --- a/tests/test_ast_parsing.py +++ b/tests/test_ast_parsing.py @@ -415,6 +415,7 @@ ALL_TESTS = [ Test("user_defined_value_type/erc20-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15)), Test("user_defined_value_type/in_parenthesis-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15)), Test("bytes_call.sol", ["0.8.12"]), + Test("modifier_identifier_path.sol", VERSIONS_08), Test("free_functions/libraries_from_free.sol", ["0.8.12"]), Test("free_functions/new_operator.sol", ["0.8.12"]), Test("free_functions/library_constant_function_collision.sol", ["0.8.12"]),