summaryrefslogtreecommitdiff
path: root/src/sexpr/variant.py
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-08-13 14:55:49 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-08-27 11:29:45 -0700
commit9951ad78c80e144c166a7d476cad7ffdf84332a9 (patch)
tree9f5498a9a3c23b62dc928288e72081e99f958f46 /src/sexpr/variant.py
parent749fec734c4583153fb2dbc80f1d21db2c2ab457 (diff)
downloadtmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.gz
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.bz2
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.xz
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.zip
Debug debugging
Diffstat (limited to 'src/sexpr/variant.py')
-rw-r--r--src/sexpr/variant.py22
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!"}'),
+ ]