pull/673/head
Josselin 4 years ago
parent 394cc6bb59
commit 91bfae97b8
  1. 2
      slither/slithir/convert.py
  2. 12
      slither/visitors/slithir/expression_to_slithir.py
  3. 1
      tests/test_ast_parsing.py

@ -1417,7 +1417,7 @@ def remove_unused(result):
# Remove type(X) if X is an elementary type
# This assume that type(X) is only used with min/max
# If Solidity introduces other operation, we might remove this removal
if isinstance(ins, SolidityCall) and ins.function == SolidityFunction('type()'):
if isinstance(ins, SolidityCall) and ins.function == SolidityFunction("type()"):
if isinstance(ins.arguments[0], ElementaryType):
to_remove.append(ins)

@ -370,17 +370,9 @@ class ExpressionToSlithIR(ExpressionVisitor):
assert isinstance(type_expression_found, ElementaryTypeNameExpression)
type_found = type_expression_found.type
if expression.member_name == "min:":
op = Assignment(
val,
Constant(str(type_found.min), type_found),
type_found,
)
op = Assignment(val, Constant(str(type_found.min), type_found), type_found,)
else:
op = Assignment(
val,
Constant(str(type_found.max), type_found),
type_found,
)
op = Assignment(val, Constant(str(type_found.max), type_found), type_found,)
self._result.append(op)
set_val(expression, val)
return

@ -502,6 +502,7 @@ def generate_output(sl: Slither) -> Dict[str, Dict[str, str]]:
ALL_TESTS = get_all_test()
def set_solc(test_item: Item):
# hacky hack hack to pick the solc version we want
env = dict(os.environ)

Loading…
Cancel
Save