diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-10-04 18:25:47 +0200 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-12-08 10:08:10 -0800 |
| commit | b1ab21fb8d1ee809533bc71fc00f2a11cab49b8e (patch) | |
| tree | a9e890c2b5573c678cb0b0d9906bb673e0b96564 | |
| parent | e2ebe0ef46a8b4619e219eef88df7660a0a0b4eb (diff) | |
| download | meson-b1ab21fb8d1ee809533bc71fc00f2a11cab49b8e.tar.gz | |
mparser: use a literal for arithmetic operators
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| -rw-r--r-- | mesonbuild/mparser.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index f80706a90..030905285 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -459,10 +459,9 @@ class ComparisonNode(BinaryOperatorNode): @dataclass(unsafe_hash=True) class ArithmeticNode(BinaryOperatorNode): - # TODO: use a Literal for operation - operation: str + operation: ARITH_OPERATORS - def __init__(self, operation: str, left: BaseNode, operator: SymbolNode, right: BaseNode): + def __init__(self, operation: ARITH_OPERATORS, left: BaseNode, operator: SymbolNode, right: BaseNode): super().__init__(left, operator, right) self.operation = operation @@ -675,6 +674,7 @@ class ParenthesizedNode(BaseNode): if T.TYPE_CHECKING: COMPARISONS = Literal['==', '!=', '<', '<=', '>=', '>', 'in', 'not in'] + ARITH_OPERATORS = Literal['add', 'sub', 'mul', 'div', 'mod'] comparison_map: T.Mapping[str, COMPARISONS] = { 'equal': '==', |
