syntax-tree-accessors #2
@ -42,9 +42,8 @@ func (parser *ParsingOperation) parseArgument () (argument Argument, err error)
|
||||
return
|
||||
}
|
||||
|
||||
declaration := Declaration {
|
||||
what: what,
|
||||
}
|
||||
declaration := Declaration { }
|
||||
declaration.what = what
|
||||
declaration.setName(identifier.trail[0])
|
||||
declaration.setLocation(argument.Location())
|
||||
|
||||
|
@ -43,3 +43,18 @@ func (trait nameable) Name () (name string) {
|
||||
func (trait *nameable) setName (name string) {
|
||||
trait.name = name
|
||||
}
|
||||
|
||||
// typeable allows a node to have a type.
|
||||
type typeable struct {
|
||||
what Type
|
||||
}
|
||||
|
||||
// Type returns the type of the node.
|
||||
func (trait typeable) Type () (what Type) {
|
||||
return trait.what
|
||||
}
|
||||
|
||||
// setType sets the type of the node.
|
||||
func (trait *typeable) setType (what Type) () {
|
||||
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ func (section *TypeSection) ToString (indent int) (output string) {
|
||||
"type ",
|
||||
section.permission.ToString(), " ",
|
||||
section.name, ":",
|
||||
section.inherits.ToString())
|
||||
section.what.ToString())
|
||||
|
||||
isComplexInitialization :=
|
||||
section.defaultValue.kind == ArgumentKindObjectInitializationValues ||
|
||||
|
@ -62,7 +62,7 @@ type Type struct {
|
||||
type Declaration struct {
|
||||
locatable
|
||||
nameable
|
||||
what Type
|
||||
typeable
|
||||
}
|
||||
|
||||
// ObjectInitializationValues represents a list of object member initialization
|
||||
@ -150,8 +150,8 @@ type Argument struct {
|
||||
type DataSection struct {
|
||||
locatable
|
||||
nameable
|
||||
typeable
|
||||
|
||||
what Type
|
||||
permission types.Permission
|
||||
value Argument
|
||||
}
|
||||
@ -160,8 +160,8 @@ type DataSection struct {
|
||||
type TypeSection struct {
|
||||
locatable
|
||||
nameable
|
||||
typeable
|
||||
|
||||
inherits Type
|
||||
permission types.Permission
|
||||
defaultValue Argument
|
||||
}
|
||||
@ -170,8 +170,8 @@ type TypeSection struct {
|
||||
type ObjtMember struct {
|
||||
locatable
|
||||
nameable
|
||||
|
||||
what Type
|
||||
typeable
|
||||
|
||||
bitWidth uint64
|
||||
permission types.Permission
|
||||
defaultValue Argument
|
||||
@ -181,8 +181,8 @@ type ObjtMember struct {
|
||||
type ObjtSection struct {
|
||||
locatable
|
||||
nameable
|
||||
inherits Identifier
|
||||
|
||||
inherits Identifier
|
||||
permission types.Permission
|
||||
members []ObjtMember
|
||||
}
|
||||
@ -198,8 +198,8 @@ type EnumMember struct {
|
||||
type EnumSection struct {
|
||||
locatable
|
||||
nameable
|
||||
|
||||
what Type
|
||||
typeable
|
||||
|
||||
permission types.Permission
|
||||
members []EnumMember
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ func (parser *ParsingOperation) parseTypeSection () (
|
||||
if err != nil { return }
|
||||
err = parser.nextToken()
|
||||
if err != nil { return }
|
||||
section.inherits, err = parser.parseType()
|
||||
section.what, err = parser.parseType()
|
||||
if err != nil { return }
|
||||
|
||||
// parse default values
|
||||
|
Reference in New Issue
Block a user