ast: change file to have a list of sections

This commit is contained in:
Michael McLoughlin
2018-12-26 18:58:12 -08:00
parent bf6031521f
commit d29c6340d7
6 changed files with 30 additions and 12 deletions

View File

@@ -22,8 +22,13 @@ func NewGoAsm(cfg Config) Printer {
func (p *goasm) Print(f *avo.File) ([]byte, error) {
p.header()
for _, fn := range f.Functions {
p.function(fn)
for _, s := range f.Sections {
switch s := s.(type) {
case *avo.Function:
p.function(s)
default:
panic("unknown section type")
}
}
return p.Result()
}