diff --git a/compiler/free.jou b/compiler/free.jou index a5eddb45..d9ca555a 100644 --- a/compiler/free.jou +++ b/compiler/free.jou @@ -5,10 +5,6 @@ import "stdlib/mem.jou" import "./types.jou" import "./typecheck/common.jou" -def free_export_symbol(es: ExportSymbol*) -> None: - if es->kind == ExportSymbolKind::Function: - es->funcsignature.free() - def free_file_types(ft: FileTypes*) -> None: for t = ft->owned_types; t < &ft->owned_types[ft->n_owned_types]; t++: free_type(*t) diff --git a/compiler/main.jou b/compiler/main.jou index c5913273..9433dc29 100644 --- a/compiler/main.jou +++ b/compiler/main.jou @@ -391,7 +391,7 @@ class CompileState: for i = 0; i < self->nfiles; i++: for es = pending_exports[i]; es->name[0] != '\0'; es++: - free_export_symbol(es) + es->free() free(pending_exports[i]) pending_exports[i] = NULL diff --git a/compiler/typecheck/common.jou b/compiler/typecheck/common.jou index 4663b135..b749fa31 100644 --- a/compiler/typecheck/common.jou +++ b/compiler/typecheck/common.jou @@ -59,6 +59,10 @@ class ExportSymbol: funcsignature: Signature type: Type* # ExportSymbolKind::Type and ExportSymbolKind::GlobalVar + def free(self) -> None: + if self->kind == ExportSymbolKind::Function: + self->funcsignature.free() + # Type information about a function or method defined in the current file. # Not created for anything imported from another file.