-
Notifications
You must be signed in to change notification settings - Fork 9
/
value_proxy.py
91 lines (73 loc) · 3.09 KB
/
value_proxy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from collections.abc import Sequence
import mypy.nodes
import mypy.types
from puya.awst.nodes import Literal, Statement
from puya.awst_build.eb.base import (
BuilderBinaryOp,
BuilderComparisonOp,
ExpressionBuilder,
Iteration,
ValueExpressionBuilder,
)
from puya.awst_build.eb.var_factory import var_expression
from puya.parse import SourceLocation
class ValueProxyExpressionBuilder(ValueExpressionBuilder):
@property
def _proxied(self) -> ExpressionBuilder:
return var_expression(self.expr)
def delete(self, location: SourceLocation) -> Statement:
return self._proxied.delete(location)
def bool_eval(self, location: SourceLocation, *, negate: bool = False) -> ExpressionBuilder:
return self._proxied.bool_eval(location, negate=negate)
def unary_plus(self, location: SourceLocation) -> ExpressionBuilder:
return self._proxied.unary_plus(location)
def unary_minus(self, location: SourceLocation) -> ExpressionBuilder:
return self._proxied.unary_minus(location)
def bitwise_invert(self, location: SourceLocation) -> ExpressionBuilder:
return self._proxied.bitwise_invert(location)
def contains(
self, item: ExpressionBuilder | Literal, location: SourceLocation
) -> ExpressionBuilder:
return self._proxied.contains(item, location)
def compare(
self, other: ExpressionBuilder | Literal, op: BuilderComparisonOp, location: SourceLocation
) -> ExpressionBuilder:
return self._proxied.compare(other, op, location)
def binary_op(
self,
other: ExpressionBuilder | Literal,
op: BuilderBinaryOp,
location: SourceLocation,
*,
reverse: bool,
) -> ExpressionBuilder:
return self._proxied.binary_op(other, op, location, reverse=reverse)
def augmented_assignment(
self, op: BuilderBinaryOp, rhs: ExpressionBuilder | Literal, location: SourceLocation
) -> Statement:
return self._proxied.augmented_assignment(op, rhs, location)
def index(
self, index: ExpressionBuilder | Literal, location: SourceLocation
) -> ExpressionBuilder:
return self._proxied.index(index, location)
def slice_index(
self,
begin_index: ExpressionBuilder | Literal | None,
end_index: ExpressionBuilder | Literal | None,
stride: ExpressionBuilder | Literal | None,
location: SourceLocation,
) -> ExpressionBuilder:
return self._proxied.slice_index(begin_index, end_index, stride, location)
def call(
self,
args: Sequence[ExpressionBuilder | Literal],
arg_kinds: list[mypy.nodes.ArgKind],
arg_names: list[str | None],
location: SourceLocation,
original_expr: mypy.nodes.CallExpr,
) -> ExpressionBuilder:
return self._proxied.call(args, arg_kinds, arg_names, location, original_expr)
def member_access(self, name: str, location: SourceLocation) -> ExpressionBuilder | Literal:
return self._proxied.member_access(name, location)
def iterate(self) -> Iteration:
return self._proxied.iterate()