Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router return subroutine #422

Merged
merged 3 commits into from
Jun 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pyteal/ast/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def add_method_handler(
overriding_name: str = None,
method_config: MethodConfig = None,
description: str = None,
) -> None:
) -> ABIReturnSubroutine:
if not isinstance(method_call, ABIReturnSubroutine):
raise TealInputError(
"for adding method handler, must be ABIReturnSubroutine"
Expand Down Expand Up @@ -576,6 +576,7 @@ def add_method_handler(
self.clear_state_ast.add_method_to_ast(
method_signature, method_clear_state_cond, method_call
)
return method_call

def method(
self,
Expand Down Expand Up @@ -607,7 +608,7 @@ def method(
# - None
# - CallConfig.Never
# both cases evaluate to False in if statement.
def wrap(_func):
def wrap(_func) -> ABIReturnSubroutine:
wrapped_subroutine = ABIReturnSubroutine(_func)
call_configs: MethodConfig
if (
Expand Down Expand Up @@ -639,7 +640,9 @@ def none_to_never(x: None | CallConfig):
update_application=_update_app,
delete_application=_delete_app,
)
self.add_method_handler(wrapped_subroutine, name, call_configs, description)
return self.add_method_handler(
wrapped_subroutine, name, call_configs, description
)

if not func:
return wrap
Expand Down