builtup4/bu4/evaluation/targets/avcall.py

26 lines
738 B
Python

# Copyright (c) PARRRATE T&V 2021. All rights reserved.
from typing import TypeVar, Generic
from bu4.evaluation.constructs.attachable import Attachable
from bu4.evaluation.constructs.eattachable import EAttachable
from bu4.evaluation.constructs.evaluable import Evaluable
from bu4.evaluation.constructs.evalue import EValue
from bu4.evaluation.targets.avtarget import AVTarget
__all__ = ('AVCall',)
T = TypeVar('T')
class AVCall(AVTarget, Generic[T]):
def __init__(self, t: T, argument: Attachable[T]):
self.t = t
self.argument = argument
def given(self, value: EValue) -> Evaluable:
return value.call(EAttachable(self.t, self.argument))
def __str__(self):
return f'({self.argument})'