add option to skip yul parsing

pull/646/head
samczsun 4 years ago
parent 0f3f4b80ed
commit 8d3f1889ec
  1. 7
      slither/__main__.py
  2. 5
      slither/core/slither_core.py
  3. 1
      slither/slither.py
  4. 4
      slither/solc_parsing/declarations/function.py
  5. 1
      slither/utils/command_line.py

@ -481,6 +481,13 @@ def parse_args(detector_classes, printer_classes):
default=defaults_flag_in_config["legacy_ast"],
)
parser.add_argument(
"--skip-assembly",
help=argparse.SUPPRESS,
action="store_true",
default=defaults_flag_in_config["skip_assembly"],
)
parser.add_argument(
"--ignore-return-value",
help=argparse.SUPPRESS,

@ -76,6 +76,7 @@ class SlitherCore(Context): # pylint: disable=too-many-instance-attributes,too-
# If set to true, slither will not catch errors during parsing
self._disallow_partial: bool = False
self._skip_assembly: bool = False
###################################################################################
###################################################################################
@ -390,6 +391,10 @@ class SlitherCore(Context): # pylint: disable=too-many-instance-attributes,too-
"""
return self._disallow_partial
@property
def skip_assembly(self) -> bool:
return self._skip_assembly
# endregion
###################################################################################
###################################################################################

@ -59,6 +59,7 @@ class Slither(SlitherCore): # pylint: disable=too-many-instance-attributes
self._parser: SlitherSolc # This could be another parser, like SlitherVyper, interface needs to be determined
self._disallow_partial: bool = kwargs.get("disallow_partial", False)
self._skip_assembly: bool = kwargs.get("skip_assembly", False)
# list of files provided (see --splitted option)
if isinstance(target, list):

@ -835,7 +835,7 @@ class FunctionSolc:
node = self._parse_block(statement, node)
elif name == "InlineAssembly":
# Added with solc 0.6 - the yul code is an AST
if "AST" in statement:
if "AST" in statement and not self.slither.skip_assembly:
self._function.contains_assembly = True
yul_object = self._new_yul_block(statement["src"])
entrypoint = yul_object.entrypoint
@ -849,6 +849,8 @@ class FunctionSolc:
asm_node = self._new_node(NodeType.ASSEMBLY, statement["src"])
self._function.contains_assembly = True
# Added with solc 0.4.12
if "AST" in statement:
asm_node.underlying_node.add_inline_asm(statement["AST"])
if "operations" in statement:
asm_node.underlying_node.add_inline_asm(statement["operations"])
link_underlying_nodes(node, asm_node)

@ -39,6 +39,7 @@ defaults_flag_in_config = {
"filter_paths": None,
"generate_patches": False,
# debug command
"skip_assembly": False,
"legacy_ast": False,
"ignore_return_value": False,
"zip": None,

Loading…
Cancel
Save