v.ast: add .free() methods, so vls can be more decoupled
parent
eaf930aa8b
commit
cfcecf898b
|
@ -564,6 +564,24 @@ pub mut:
|
|||
global_labels []string // from `asm { .globl labelname }`
|
||||
}
|
||||
|
||||
[unsafe]
|
||||
pub fn (f &File) free() {
|
||||
unsafe {
|
||||
f.path.free()
|
||||
f.path_base.free()
|
||||
f.scope.free()
|
||||
f.stmts.free()
|
||||
f.imports.free()
|
||||
f.auto_imports.free()
|
||||
f.embedded_files.free()
|
||||
f.imported_symbols.free()
|
||||
f.errors.free()
|
||||
f.warnings.free()
|
||||
f.notices.free()
|
||||
f.global_labels.free()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IdentFn {
|
||||
pub mut:
|
||||
typ Type
|
||||
|
|
|
@ -15,6 +15,18 @@ pub mut:
|
|||
end_pos int
|
||||
}
|
||||
|
||||
[unsafe]
|
||||
pub fn (s &Scope) free() {
|
||||
unsafe {
|
||||
s.objects.free()
|
||||
s.struct_fields.free()
|
||||
for child in s.children {
|
||||
child.free()
|
||||
}
|
||||
s.children.free()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_scope(parent &Scope, start_pos int) &Scope {
|
||||
return &Scope{
|
||||
parent: parent
|
||||
|
|
|
@ -24,6 +24,24 @@ pub mut:
|
|||
used_consts map[string]bool // filled in by the checker, when pref.skip_unused = true;
|
||||
}
|
||||
|
||||
[unsafe]
|
||||
pub fn (t &Table) free() {
|
||||
unsafe {
|
||||
t.type_symbols.free()
|
||||
t.type_idxs.free()
|
||||
t.fns.free()
|
||||
t.dumps.free()
|
||||
t.imports.free()
|
||||
t.modules.free()
|
||||
t.cflags.free()
|
||||
t.redefined_fns.free()
|
||||
t.fn_generic_types.free()
|
||||
t.cmod_prefix.free()
|
||||
t.used_fns.free()
|
||||
t.used_consts.free()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Fn {
|
||||
pub:
|
||||
params []Param
|
||||
|
|
Loading…
Reference in New Issue