From 9951ad78c80e144c166a7d476cad7ffdf84332a9 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 13 Aug 2014 14:55:49 -0700 Subject: Debug debugging --- src/map/magic-expr.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/map/magic-expr.py (limited to 'src/map/magic-expr.py') diff --git a/src/map/magic-expr.py b/src/map/magic-expr.py new file mode 100644 index 0000000..cdb2bcf --- /dev/null +++ b/src/map/magic-expr.py @@ -0,0 +1,32 @@ +class fun_t(object): + __slots__ = ('_value') + + name = 'tmwa::magic::fun_t' + depth = 1 + enabled = True + + def __init__(self, value): + if not value: + value = None + self._value = value + + def to_string(self): + value = self._value + if value is None: + return '(fun_t *) nullptr' + return '(fun_t *)' + + def children(self): + value = self._value + if value is None: + return + value = value.dereference() + yield '->name', value['name'] + yield '->signature', value['signature'] + yield '->ret_ty', value['ret_ty'] + yield '->fun', value['fun'] + + tests = [ + ('static_cast(nullptr)', '(fun_t *) nullptr'), + ('new tmwa::magic::fun_t{"name"_s, "sig"_s, \'\\0\', nullptr}', '(fun_t *) = {->name = "name", ->signature = "sig", ->ret_ty = 0 \'\\000\', ->fun = 0x0}'), + ] -- cgit v1.2.3-70-g09d2