# Copyright (c) PARRRATE T&V 2021. All rights reserved. from bu4.evaluation.av.aftervalue import AfterValue from bu4.evaluation.av.evtype import evtype from bu4.evaluation.constructs.eattachable import EAttachable from bu4.evaluation.constructs.evaluable import Evaluable from bu4.evaluation.targets.avcall import AVCall from bu4.indexing.constructs.indexed import Indexed from bu4.parsing.codes import CODE_CALL __all__ = ('ICall',) class ICall(Indexed): def __init__(self, argument: Indexed, lambda_: Indexed): self.argument = argument self.lambda_ = lambda_ def attach(self, ev: evtype) -> Evaluable: return AfterValue(EAttachable(ev, self.lambda_), AVCall(ev, self.argument)) def __str__(self): return f'/{self.argument}{self.lambda_}' def __bytes__(self): return bytes([CODE_CALL, *bytes(self.argument), *bytes(self.lambda_)])