write prInt

This commit is contained in:
nora 2023-07-30 23:05:57 +02:00
parent d9868e3111
commit 7f65dc0277
8 changed files with 155 additions and 40 deletions

View file

@ -541,11 +541,13 @@ function printImport(import_: Import, f: Formatter) {
});
}
function printFunction(func: Func, f: Formatter) {
function printFunction(func: Func, idx: number, f: Formatter) {
f.sexpr(() => {
f.keyword("func");
printId(func._name, f);
f.word(`(;${idx};)`, chalk.gray);
f.sexpr(() => {
f.keyword("type");
f.type(func.type);
@ -678,9 +680,9 @@ function printModule(module: Module, f: Formatter) {
printImport(import_, f);
});
module.funcs.forEach((func) => {
module.funcs.forEach((func, i) => {
breakIfAny();
printFunction(func, f);
printFunction(func, i + module.imports.length, f);
});
module.tables.forEach((table) => {