Пример #1
0
 def dump(self, nodes, obj):
     """Convert an array of items to a multiline pretty-printed
     string. The tag is produced from the type name of obj and its
     line number. See util::DumpTagged for a description of the
     nodes argument.
     """
     return dump_tagged(nodes, short_type(obj) + ':' + str(obj.line))
Пример #2
0
 def __str__(self):
     """Return a string representation of the type, which includes the most
     important information about the type.
     """
     interfaces = []
     for i in self.interfaces:
         interfaces.append(i.full_name())
     base = None
     if self.base is not None:
         base = 'Base({})'.format(self.base.full_name())
     iface = None
     if self.is_interface:
         iface = 'Interface'
     return dump_tagged(['Name({})'.format(self.full_name()),
                         iface,
                         base,
                         ('Interfaces', interfaces),
                         ('Vars', sorted(self.vars.keys())),
                         ('Methods', sorted(self.methods.keys()))],
                        'TypeInfo')
Пример #3
0
        This includes the most important information about the type.
        """
        str[] interfaces = []
        for i in self.interfaces:
            interfaces.append(i.full_name())
        str base = None
        if self.base is not None:
            base = 'Base({})'.format(self.base.full_name())
        str iface = None
        if self.is_interface:
            iface = 'Interface'
        return dump_tagged(['Name({})'.format(self.full_name()),
                            iface,
                            base,
                            ('Interfaces', interfaces),
                            ('Vars', sorted(self.vars.keys())),
                            ('Methods', sorted(self.methods.keys()))],
                           'TypeInfo')


class SymbolTable(dict<str, SymbolTableNode>):
    str __str__(self):
        str[] a = []
        for key, value in self.items():
            # Filter out the implicit import of builtins.
            if isinstance(value, SymbolTableNode):
                if (value.full_name() != 'builtins' and
                        not value.full_name().endswith('.__name__')):
                    a.append('  ' + str(key) + ' : ' + str(value))
            else: