summaryrefslogblamecommitdiff
path: root/src/map/magic-expr.py
blob: f53ddc83aada3f43464aa2ec37836bf4c4f2db73 (plain) (tree)
1
2
3
4


                          
                                    























                                               



                               
             
                                                               
                                     
                                                                                
                                                                                                               
     
class fun_t(object):
    __slots__ = ('_value')

    name = 'tmwa::map::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']

    test_extra = '''
    using tmwa::operator "" _s;
    '''

    tests = [
            ('static_cast<tmwa::map::magic::fun_t *>(nullptr)',
                '(fun_t *) nullptr'),
            ('new tmwa::map::magic::fun_t{"name"_s, "sig"_s, \'\\0\', nullptr}',
                '(fun_t *) = {->name = "name", ->signature = "sig", ->ret_ty = 0 \'\\000\', ->fun = nullptr}'),
    ]