ast,build: add Attributes fields to Function and Global

Updates #2
This commit is contained in:
Michael McLoughlin
2018-12-30 23:35:49 -08:00
parent 5d270d8d76
commit e364d6398e
17 changed files with 86 additions and 50 deletions

19
ast.go
View File

@@ -117,10 +117,11 @@ func (f *File) Functions() []*Function {
// Function represents an assembly function.
type Function struct {
Name string
Doc []string
Signature *gotypes.Signature
LocalSize int
Name string
Attributes Attribute
Doc []string
Signature *gotypes.Signature
LocalSize int
Nodes []Node
@@ -213,14 +214,16 @@ func (d Datum) Overlaps(other Datum) bool {
}
type Global struct {
Symbol operand.Symbol
Data []Datum
Size int
Symbol operand.Symbol
Attributes Attribute
Data []Datum
Size int
}
func NewGlobal(sym operand.Symbol) *Global {
return &Global{
Symbol: sym,
Symbol: sym,
Attributes: RODATA,
}
}