syntax-tree-accessors #2
@ -42,9 +42,8 @@ func (parser *ParsingOperation) parseArgument () (argument Argument, err error)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
declaration := Declaration {
|
declaration := Declaration { }
|
||||||
what: what,
|
declaration.what = what
|
||||||
}
|
|
||||||
declaration.setName(identifier.trail[0])
|
declaration.setName(identifier.trail[0])
|
||||||
declaration.setLocation(argument.Location())
|
declaration.setLocation(argument.Location())
|
||||||
|
|
||||||
|
|||||||
@ -43,3 +43,18 @@ func (trait nameable) Name () (name string) {
|
|||||||
func (trait *nameable) setName (name string) {
|
func (trait *nameable) setName (name string) {
|
||||||
trait.name = name
|
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 ",
|
"type ",
|
||||||
section.permission.ToString(), " ",
|
section.permission.ToString(), " ",
|
||||||
section.name, ":",
|
section.name, ":",
|
||||||
section.inherits.ToString())
|
section.what.ToString())
|
||||||
|
|
||||||
isComplexInitialization :=
|
isComplexInitialization :=
|
||||||
section.defaultValue.kind == ArgumentKindObjectInitializationValues ||
|
section.defaultValue.kind == ArgumentKindObjectInitializationValues ||
|
||||||
|
|||||||
@ -62,7 +62,7 @@ type Type struct {
|
|||||||
type Declaration struct {
|
type Declaration struct {
|
||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
what Type
|
typeable
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectInitializationValues represents a list of object member initialization
|
// ObjectInitializationValues represents a list of object member initialization
|
||||||
@ -150,8 +150,8 @@ type Argument struct {
|
|||||||
type DataSection struct {
|
type DataSection struct {
|
||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
|
typeable
|
||||||
|
|
||||||
what Type
|
|
||||||
permission types.Permission
|
permission types.Permission
|
||||||
value Argument
|
value Argument
|
||||||
}
|
}
|
||||||