handle comments
This commit is contained in:
@@ -11,6 +11,7 @@ type FullyQualified struct {
|
||||
func NewFullyQualified(Parts []node.Node) node.Node {
|
||||
return &FullyQualified{
|
||||
Name{
|
||||
nil,
|
||||
nil,
|
||||
Parts,
|
||||
},
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package name
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type Name struct {
|
||||
position *node.Position
|
||||
comments *[]comment.Comment
|
||||
Parts []node.Node
|
||||
}
|
||||
|
||||
func NewName(Parts []node.Node) node.Node {
|
||||
return &Name{
|
||||
nil,
|
||||
nil,
|
||||
Parts,
|
||||
}
|
||||
@@ -29,6 +32,15 @@ func (n Name) SetPosition(p *node.Position) node.Node {
|
||||
return n
|
||||
}
|
||||
|
||||
func (n Name) Comments() *[]comment.Comment {
|
||||
return n.comments
|
||||
}
|
||||
|
||||
func (n Name) SetComments(c []comment.Comment) node.Node {
|
||||
n.comments = &c
|
||||
return n
|
||||
}
|
||||
|
||||
func (n Name) Walk(v node.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package name
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type NamePart struct {
|
||||
position *node.Position
|
||||
comments *[]comment.Comment
|
||||
Value string
|
||||
}
|
||||
|
||||
func NewNamePart(Value string) node.Node {
|
||||
return &NamePart{
|
||||
nil,
|
||||
nil,
|
||||
Value,
|
||||
}
|
||||
@@ -31,6 +34,15 @@ func (n NamePart) SetPosition(p *node.Position) node.Node {
|
||||
return n
|
||||
}
|
||||
|
||||
func (n NamePart) Comments() *[]comment.Comment {
|
||||
return n.comments
|
||||
}
|
||||
|
||||
func (n NamePart) SetComments(c []comment.Comment) node.Node {
|
||||
n.comments = &c
|
||||
return n
|
||||
}
|
||||
|
||||
func (n NamePart) Walk(v node.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
|
||||
@@ -11,6 +11,7 @@ type Relative struct {
|
||||
func NewRelative(Parts []node.Node) node.Node {
|
||||
return &Relative{
|
||||
Name{
|
||||
nil,
|
||||
nil,
|
||||
Parts,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user