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 # Remove type(X) if X is an elementary type
# This assume that type(X) is only used with min/max # This assume that type(X) is only used with min/max
# If Solidity introduces other operation, we might remove this removal # 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): if isinstance(ins.arguments[0], ElementaryType):
to_remove.append(ins) to_remove.append(ins)

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

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

Loading…
Cancel
Save