fix comments pointers
This commit is contained in:
@@ -22,7 +22,7 @@ type lexer struct {
|
||||
*lex.Lexer
|
||||
stateStack []int
|
||||
phpDocComment string
|
||||
comments *[]comment.Comment
|
||||
comments []comment.Comment
|
||||
}
|
||||
|
||||
func rune2Class(r rune) int {
|
||||
@@ -101,9 +101,5 @@ func (l *lexer) newToken(tokenBytes []byte) t.Token {
|
||||
}
|
||||
|
||||
func (l *lexer) addComment(c comment.Comment) {
|
||||
if l.comments == nil {
|
||||
l.comments = &[]comment.Comment{c}
|
||||
} else {
|
||||
*l.comments = append(*l.comments, c)
|
||||
}
|
||||
l.comments = append(l.comments, c)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func Parse(src io.Reader, fName string) node.Node {
|
||||
return rootnode
|
||||
}
|
||||
|
||||
func ListGetFirstNodeComments(list []node.Node) *[]comment.Comment {
|
||||
func ListGetFirstNodeComments(list []node.Node) []comment.Comment {
|
||||
if len(list) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ func Parse(src io.Reader, fName string) node.Node {
|
||||
return rootnode
|
||||
}
|
||||
|
||||
func ListGetFirstNodeComments(list []node.Node) *[]comment.Comment {
|
||||
func ListGetFirstNodeComments(list []node.Node) []comment.Comment {
|
||||
if len(list) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user