From 63ade7d9378cae8ec2a811581684bf459407a7f0 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Fri, 11 Jun 2021 16:58:13 +0200 Subject: interpreter: Add a new MesonInterpreterObject for non-elementary objects --- mesonbuild/interpreterbase/baseobjects.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mesonbuild/interpreterbase/baseobjects.py') diff --git a/mesonbuild/interpreterbase/baseobjects.py b/mesonbuild/interpreterbase/baseobjects.py index 3e3963f..511a146 100644 --- a/mesonbuild/interpreterbase/baseobjects.py +++ b/mesonbuild/interpreterbase/baseobjects.py @@ -51,12 +51,15 @@ class InterpreterObject: return method(args, kwargs) raise InvalidCode('Unknown method "%s" in object.' % method_name) +class MesonInterpreterObject(InterpreterObject): + ''' All non-elementary objects should be derived from this ''' + class MutableInterpreterObject: ''' Dummy class to mark the object type as mutable ''' TV_InterpreterObject = T.TypeVar('TV_InterpreterObject') -class ObjectHolder(InterpreterObject, T.Generic[TV_InterpreterObject]): +class ObjectHolder(MesonInterpreterObject, T.Generic[TV_InterpreterObject]): def __init__(self, obj: TV_InterpreterObject, *, subproject: T.Optional[str] = None) -> None: super().__init__(subproject=subproject) self.held_object = obj @@ -64,7 +67,7 @@ class ObjectHolder(InterpreterObject, T.Generic[TV_InterpreterObject]): def __repr__(self) -> str: return f'' -class RangeHolder(InterpreterObject): +class RangeHolder(MesonInterpreterObject): def __init__(self, start: int, stop: int, step: int, *, subproject: T.Optional[str] = None) -> None: super().__init__(subproject=subproject) self.range = range(start, stop, step) -- cgit v1.1