Skip to content

Commit

Permalink
add default value
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Mar 19, 2024
1 parent 3931761 commit 1895549
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vyper/builtins/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,23 +1061,24 @@ def fetch_call_return(self, node):

kwargz = {i.arg: i.value for i in node.keywords}

delegate_call = kwargz.get("is_delegate_call")
static_call = kwargz.get("is_static_call")
delegate_call = kwargz.get("is_delegate_call", False)
static_call = kwargz.get("is_static_call", False)
if delegate_call and static_call:
raise ArgumentException(
"Call may use one of `is_delegate_call` or `is_static_call`, not both"
"Call may use one of `is_delegate_call` or `is_static_call`, not both", node
)

value = kwargz.get("value")
if (delegate_call or static_call) and value is not None:
raise ArgumentException("value= may not be passed for static or delegate calls!")
raise ArgumentException("value= may not be passed for static or delegate calls!", node)

fn_node = node.get_ancestor(vy_ast.FunctionDef)
fn_type = fn_node._metadata["func_type"]
if not static_call and not fn_type.is_mutable:
raise StateAccessViolation(
f"Cannot make modifying calls from {fn_type.mutability},"
" use `is_static_call=True` to perform this action"
" use `is_static_call=True` to perform this action",
node,
)

outsize = kwargz.get("max_outsize")
Expand Down

0 comments on commit 1895549

Please sign in to comment.