From 28da1ad03137a608770a5875ac3e4ad4ffe39034 Mon Sep 17 00:00:00 2001 From: Josselin Date: Sun, 7 Mar 2021 18:30:40 +0100 Subject: [PATCH 1/2] Add support for stop() in yul (fix #742) --- slither/solc_parsing/yul/parse_yul.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/slither/solc_parsing/yul/parse_yul.py b/slither/solc_parsing/yul/parse_yul.py index e3fae77f09..764369d71e 100644 --- a/slither/solc_parsing/yul/parse_yul.py +++ b/slither/solc_parsing/yul/parse_yul.py @@ -647,7 +647,13 @@ def parse_yul_function_call(root: YulScope, node: YulNode, ast: Dict) -> Optiona if name in unary_ops: return UnaryOperation(args[0], unary_ops[name]) - ident = Identifier(SolidityFunction(format_function_descriptor(ident.value.name))) + if name == "stop": + name = "return" + ident = Identifier(SolidityFunction(format_function_descriptor(name))) + args = [Literal("0", ElementaryType("uint256")), Literal("0", ElementaryType("uint256"))] + + else: + ident = Identifier(SolidityFunction(format_function_descriptor(ident.value.name))) if isinstance(ident.value, Function): return CallExpression(ident, args, vars_to_typestr(ident.value.returns)) From 2af8b2b4256981a1199e3c2796467005db987695 Mon Sep 17 00:00:00 2001 From: Josselin Date: Sun, 7 Mar 2021 18:33:21 +0100 Subject: [PATCH 2/2] run black --- slither/solc_parsing/yul/parse_yul.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slither/solc_parsing/yul/parse_yul.py b/slither/solc_parsing/yul/parse_yul.py index 764369d71e..4a47ef8009 100644 --- a/slither/solc_parsing/yul/parse_yul.py +++ b/slither/solc_parsing/yul/parse_yul.py @@ -650,7 +650,10 @@ def parse_yul_function_call(root: YulScope, node: YulNode, ast: Dict) -> Optiona if name == "stop": name = "return" ident = Identifier(SolidityFunction(format_function_descriptor(name))) - args = [Literal("0", ElementaryType("uint256")), Literal("0", ElementaryType("uint256"))] + args = [ + Literal("0", ElementaryType("uint256")), + Literal("0", ElementaryType("uint256")), + ] else: ident = Identifier(SolidityFunction(format_function_descriptor(ident.value.name)))