diff options
Diffstat (limited to 'src/sexpr/variant.py')
-rw-r--r-- | src/sexpr/variant.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sexpr/variant.py b/src/sexpr/variant.py new file mode 100644 index 0000000..3be402a --- /dev/null +++ b/src/sexpr/variant.py @@ -0,0 +1,22 @@ +class Variant(object): + __slots__ = ('_value') + name = 'tmwa::sexpr::Variant' + enabled = True + + def __init__(self, value): + self._value = value + + def to_string(self): + return None + + def children(self): + value = self._value + data = value['data'] + state = value['state'] + ty = value.type.template_argument(state) + yield '(%s)' % ty, data.address.cast(ty.pointer()).dereference() + + tests = [ + ('tmwa::sexpr::Variant<int, const char *>(42)', '{(int) = 42}'), + ('tmwa::sexpr::Variant<int, const char *>("Hello, World!")', '{(const char *) = "Hello, World!"}'), + ] |