remove Attribute SetAttributes methods

This commit is contained in:
z7zmey
2018-01-04 22:09:48 +02:00
parent dc8808a7d6
commit 02807502d3
149 changed files with 35 additions and 1365 deletions

View File

@@ -22,15 +22,6 @@ func (n AltElse) Attributes() map[string]interface{} {
return n.attributes
}
func (n AltElse) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n AltElse) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n AltElse) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n AltElseIf) Attributes() map[string]interface{} {
return n.attributes
}
func (n AltElseIf) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n AltElseIf) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n AltElseIf) Position() *node.Position {
return n.position
}

View File

@@ -28,15 +28,6 @@ func (n AltIf) Attributes() map[string]interface{} {
return n.attributes
}
func (n AltIf) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n AltIf) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n AltIf) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Break) Attributes() map[string]interface{} {
return n.attributes
}
func (n Break) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Break) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Break) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n Case) Attributes() map[string]interface{} {
return n.attributes
}
func (n Case) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Case) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Case) Position() *node.Position {
return n.position
}

View File

@@ -26,15 +26,6 @@ func (n Catch) Attributes() map[string]interface{} {
return n.attributes
}
func (n Catch) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Catch) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Catch) Position() *node.Position {
return n.position
}

View File

@@ -34,15 +34,6 @@ func (n Class) Attributes() map[string]interface{} {
return n.attributes
}
func (n Class) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Class) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Class) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n ClassConstList) Attributes() map[string]interface{} {
return n.attributes
}
func (n ClassConstList) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n ClassConstList) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n ClassConstList) Position() *node.Position {
return n.position
}

View File

@@ -33,15 +33,6 @@ func (n ClassMethod) Attributes() map[string]interface{} {
return n.attributes
}
func (n ClassMethod) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n ClassMethod) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n ClassMethod) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n ConstList) Attributes() map[string]interface{} {
return n.attributes
}
func (n ConstList) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n ConstList) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n ConstList) Position() *node.Position {
return n.position
}

View File

@@ -26,15 +26,6 @@ func (n Constant) Attributes() map[string]interface{} {
return n.attributes
}
func (n Constant) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Constant) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Constant) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Continue) Attributes() map[string]interface{} {
return n.attributes
}
func (n Continue) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Continue) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Continue) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n Declare) Attributes() map[string]interface{} {
return n.attributes
}
func (n Declare) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Declare) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Declare) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Default) Attributes() map[string]interface{} {
return n.attributes
}
func (n Default) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Default) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Default) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n Do) Attributes() map[string]interface{} {
return n.attributes
}
func (n Do) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Do) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Do) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Echo) Attributes() map[string]interface{} {
return n.attributes
}
func (n Echo) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Echo) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Echo) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Else) Attributes() map[string]interface{} {
return n.attributes
}
func (n Else) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Else) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Else) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n ElseIf) Attributes() map[string]interface{} {
return n.attributes
}
func (n ElseIf) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n ElseIf) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n ElseIf) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Expression) Attributes() map[string]interface{} {
return n.attributes
}
func (n Expression) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Expression) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Expression) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Finally) Attributes() map[string]interface{} {
return n.attributes
}
func (n Finally) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Finally) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Finally) Position() *node.Position {
return n.position
}

View File

@@ -28,15 +28,6 @@ func (n For) Attributes() map[string]interface{} {
return n.attributes
}
func (n For) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n For) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n For) Position() *node.Position {
return n.position
}

View File

@@ -30,15 +30,6 @@ func (n Foreach) Attributes() map[string]interface{} {
return n.attributes
}
func (n Foreach) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Foreach) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Foreach) Position() *node.Position {
return n.position
}

View File

@@ -5,39 +5,38 @@ import (
)
type Function struct {
attributes map[string]interface{}
position *node.Position
functionName node.Node
params []node.Node
returnType node.Node
stmts []node.Node
attributes map[string]interface{}
position *node.Position
ReturnsRef bool
PhpDocComment string
FunctionName node.Node
Params []node.Node
ReturnType node.Node
Stmts []node.Node
}
func NewFunction(functionName node.Node, returnsRef bool, params []node.Node, returnType node.Node, stmts []node.Node, phpDocComment string) node.Node {
func NewFunction(FunctionName node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) node.Node {
return &Function{
map[string]interface{}{
"returnsRef": returnsRef,
"phpDocComment": phpDocComment,
"ReturnsRef": ReturnsRef,
"PhpDocComment": PhpDocComment,
},
nil,
functionName,
params,
returnType,
stmts,
ReturnsRef,
PhpDocComment,
FunctionName,
Params,
ReturnType,
Stmts,
}
}
func (n Function) Attributes() map[string]interface{} {
return n.attributes
}
func (n Function) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Function) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
// return n.attributes
return map[string]interface{}{
"ReturnsRef": n.ReturnsRef,
"PhpDocComment": n.PhpDocComment,
}
}
func (n Function) Position() *node.Position {
@@ -54,26 +53,26 @@ func (n Function) Walk(v node.Visitor) {
return
}
if n.functionName != nil {
vv := v.GetChildrenVisitor("functionName")
n.functionName.Walk(vv)
if n.FunctionName != nil {
vv := v.GetChildrenVisitor("FunctionName")
n.FunctionName.Walk(vv)
}
if n.params != nil {
vv := v.GetChildrenVisitor("params")
for _, nn := range n.params {
if n.Params != nil {
vv := v.GetChildrenVisitor("Params")
for _, nn := range n.Params {
nn.Walk(vv)
}
}
if n.returnType != nil {
vv := v.GetChildrenVisitor("returnType")
n.returnType.Walk(vv)
if n.ReturnType != nil {
vv := v.GetChildrenVisitor("ReturnType")
n.ReturnType.Walk(vv)
}
if n.stmts != nil {
vv := v.GetChildrenVisitor("stmts")
for _, nn := range n.stmts {
if n.Stmts != nil {
vv := v.GetChildrenVisitor("Stmts")
for _, nn := range n.Stmts {
nn.Walk(vv)
}
}

View File

@@ -22,15 +22,6 @@ func (n Global) Attributes() map[string]interface{} {
return n.attributes
}
func (n Global) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Global) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Global) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Goto) Attributes() map[string]interface{} {
return n.attributes
}
func (n Goto) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Goto) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Goto) Position() *node.Position {
return n.position
}

View File

@@ -26,15 +26,6 @@ func (n GroupUse) Attributes() map[string]interface{} {
return n.attributes
}
func (n GroupUse) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n GroupUse) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n GroupUse) Position() *node.Position {
return n.position
}

View File

@@ -20,15 +20,6 @@ func (n HaltCompiler) Attributes() map[string]interface{} {
return n.attributes
}
func (n HaltCompiler) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n HaltCompiler) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n HaltCompiler) Position() *node.Position {
return n.position
}

View File

@@ -28,15 +28,6 @@ func (n If) Attributes() map[string]interface{} {
return n.attributes
}
func (n If) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n If) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n If) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n InlineHtml) Attributes() map[string]interface{} {
return n.attributes
}
func (n InlineHtml) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n InlineHtml) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n InlineHtml) Position() *node.Position {
return n.position
}

View File

@@ -28,15 +28,6 @@ func (n Interface) Attributes() map[string]interface{} {
return n.attributes
}
func (n Interface) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Interface) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Interface) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Label) Attributes() map[string]interface{} {
return n.attributes
}
func (n Label) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Label) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Label) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n Namespace) Attributes() map[string]interface{} {
return n.attributes
}
func (n Namespace) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Namespace) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Namespace) Position() *node.Position {
return n.position
}

View File

@@ -20,15 +20,6 @@ func (n Nop) Attributes() map[string]interface{} {
return n.attributes
}
func (n Nop) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Nop) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Nop) Position() *node.Position {
return n.position
}

View File

@@ -25,15 +25,6 @@ func (n Property) Attributes() map[string]interface{} {
return n.attributes
}
func (n Property) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Property) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Property) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n PropertyList) Attributes() map[string]interface{} {
return n.attributes
}
func (n PropertyList) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n PropertyList) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n PropertyList) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Return) Attributes() map[string]interface{} {
return n.attributes
}
func (n Return) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Return) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Return) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Static) Attributes() map[string]interface{} {
return n.attributes
}
func (n Static) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Static) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Static) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n StaticVar) Attributes() map[string]interface{} {
return n.attributes
}
func (n StaticVar) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n StaticVar) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n StaticVar) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n StmtList) Attributes() map[string]interface{} {
return n.attributes
}
func (n StmtList) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n StmtList) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n StmtList) Position() *node.Position {
return n.position
}

View File

@@ -27,15 +27,6 @@ func (n Switch) Attributes() map[string]interface{} {
return n.attributes
}
func (n Switch) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Switch) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Switch) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Throw) Attributes() map[string]interface{} {
return n.attributes
}
func (n Throw) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Throw) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Throw) Position() *node.Position {
return n.position
}

View File

@@ -26,15 +26,6 @@ func (n Trait) Attributes() map[string]interface{} {
return n.attributes
}
func (n Trait) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Trait) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Trait) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n TraitMethodRef) Attributes() map[string]interface{} {
return n.attributes
}
func (n TraitMethodRef) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n TraitMethodRef) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n TraitMethodRef) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n TraitUse) Attributes() map[string]interface{} {
return n.attributes
}
func (n TraitUse) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n TraitUse) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n TraitUse) Position() *node.Position {
return n.position
}

View File

@@ -26,15 +26,6 @@ func (n TraitUseAlias) Attributes() map[string]interface{} {
return n.attributes
}
func (n TraitUseAlias) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n TraitUseAlias) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n TraitUseAlias) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n TraitUsePrecedence) Attributes() map[string]interface{} {
return n.attributes
}
func (n TraitUsePrecedence) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n TraitUsePrecedence) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n TraitUsePrecedence) Position() *node.Position {
return n.position
}

View File

@@ -26,15 +26,6 @@ func (n Try) Attributes() map[string]interface{} {
return n.attributes
}
func (n Try) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Try) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Try) Position() *node.Position {
return n.position
}

View File

@@ -22,15 +22,6 @@ func (n Unset) Attributes() map[string]interface{} {
return n.attributes
}
func (n Unset) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Unset) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Unset) Position() *node.Position {
return n.position
}

View File

@@ -26,15 +26,6 @@ func (n Use) Attributes() map[string]interface{} {
return n.attributes
}
func (n Use) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n Use) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n Use) Position() *node.Position {
return n.position
}

View File

@@ -24,15 +24,6 @@ func (n UseList) Attributes() map[string]interface{} {
return n.attributes
}
func (n UseList) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n UseList) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n UseList) Position() *node.Position {
return n.position
}

View File

@@ -27,15 +27,6 @@ func (n While) Attributes() map[string]interface{} {
return n.attributes
}
func (n While) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n While) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n While) Position() *node.Position {
return n.position
}