handle edge case for vyper Expr nodes

pull/2099/head
alpharush 1 year ago
parent 55ab580a75
commit 4c1ad519d0
  1. 15
      slither/vyper_parsing/declarations/function.py
  2. 2
      slither/vyper_parsing/expressions/expression_parsing.py

@ -238,11 +238,14 @@ class FunctionVyper:
curr_node = new_node
# elif isinstance(expr, Assign):
# new_node = self._new_node(NodeType.EXPRESSION, expr.src, scope)
# new_node.add_unparsed_expression(expr.target)
# new_node.add_unparsed_expression(expr.value)
# link_underlying_nodes(curr_node, new_node)
elif isinstance(expr, Expr):
# TODO This is a workaround to handle Vyper putting payable/view in the function body...
if not isinstance(expr.value, Name):
new_node = self._new_node(NodeType.EXPRESSION, expr.src, scope)
new_node.add_unparsed_expression(expr.value)
link_underlying_nodes(curr_node, new_node)
curr_node = new_node
elif isinstance(expr, For):
@ -441,8 +444,6 @@ class FunctionVyper:
link_underlying_nodes(curr_node, condition_node)
curr_node = endIf_node
elif isinstance(expr, Expr):
pass
elif isinstance(expr, Pass):
pass
elif isinstance(expr, Raise):

@ -672,7 +672,7 @@ def parse_expression(expression: Dict, caller_context) -> "Expression":
rhs = parse_expression(expression.values[1], caller_context)
op = BinaryOperationType.get_type(expression.op)
parsed_expr = BinaryOperation(lhs, op)
parsed_expr = BinaryOperation(lhs, rhs, op)
parsed_expr.set_offset(expression.src, caller_context.compilation_unit)
return parsed_expr

Loading…
Cancel
Save