fix comments pointers

This commit is contained in:
z7zmey
2018-01-08 21:50:39 +02:00
parent 4ecb9edbd8
commit b7b859edaa
163 changed files with 426 additions and 430 deletions

View File

@@ -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)
}

View File

@@ -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
}

View File

@@ -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
}