summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase/operator.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/interpreterbase/operator.py')
-rw-r--r--mesonbuild/interpreterbase/operator.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/interpreterbase/operator.py b/mesonbuild/interpreterbase/operator.py
index 3419c4bec..d17cd3796 100644
--- a/mesonbuild/interpreterbase/operator.py
+++ b/mesonbuild/interpreterbase/operator.py
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import Enum
+import typing as T
class MesonOperator(Enum):
# Arithmetic
@@ -30,3 +31,7 @@ class MesonOperator(Enum):
IN = 'in'
NOT_IN = 'not in'
INDEX = '[]'
+
+# Accessing this directly is about 9x faster than calling MesonOperator(s),
+# and about 3 times faster than a staticmethod
+MAPPING: T.Mapping[str, MesonOperator] = {x.value: x for x in MesonOperator}