Better module printing

This commit is contained in:
Reid 'arrdem' McKenzie 2022-06-15 09:46:03 -06:00
parent 70ffb3a8f7
commit 0564031502

View file

@ -203,9 +203,19 @@ class Module(t.NamedTuple):
def __str__(self): def __str__(self):
b = [] b = []
b.append("functions:")
for sig, fun in self.functions.items():
b.append(f" {sig!r}:")
b.append(f" name: {fun.name}")
b.append(f" typeconstraints: {fun.typeconstraints}")
b.append(f" arguments: {fun.arguments}")
b.append(f" returns: {fun.returns}")
b.append(f" ip: {self.labels[fun.signature]}")
b.append("codepage:")
marks = {v: k for k, v in self.labels.items()} marks = {v: k for k, v in self.labels.items()}
for i, o in zip(range(1<<64), self.codepage): for i, o in zip(range(1<<64), self.codepage):
if(i in marks): if(i in marks):
b.append(f"{marks[i]}:") b.append(f" {marks[i]!r}:")
b.append(f" {i: >10}: {o}") b.append(f" {i: >10}: {o}")
return "\n".join(b) return "\n".join(b)