handle nodes positions
This commit is contained in:
@@ -5,6 +5,30 @@ import (
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
type Switch struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
position *node.Position
|
||||
token token.Token
|
||||
cond node.Node
|
||||
cases []node.Node
|
||||
}
|
||||
|
||||
func NewSwitch(token token.Token, cond node.Node, cases []node.Node) node.Node {
|
||||
return Switch{
|
||||
"Switch",
|
||||
map[string]interface{}{},
|
||||
nil,
|
||||
token,
|
||||
cond,
|
||||
cases,
|
||||
}
|
||||
}
|
||||
|
||||
func (n Switch) Name() string {
|
||||
return "Switch"
|
||||
}
|
||||
|
||||
func (n Switch) Attributes() map[string]interface{} {
|
||||
return n.attributes
|
||||
}
|
||||
@@ -26,30 +50,6 @@ func (n Switch) SetPosition(p *node.Position) node.Node {
|
||||
return n
|
||||
}
|
||||
|
||||
func (n Switch) Name() string {
|
||||
return "Switch"
|
||||
}
|
||||
|
||||
type Switch struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
position *node.Position
|
||||
token token.Token
|
||||
cond node.Node
|
||||
cases []node.Node
|
||||
}
|
||||
|
||||
func NewSwitch(token token.Token, cond node.Node, cases []node.Node) node.Node {
|
||||
return Switch{
|
||||
"Switch",
|
||||
map[string]interface{}{},
|
||||
nil,
|
||||
token,
|
||||
cond,
|
||||
cases,
|
||||
}
|
||||
}
|
||||
|
||||
func (n Switch) Walk(v node.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user