refactor tokenString

This commit is contained in:
z7zmey
2018-06-05 15:20:23 +03:00
parent 95c257c0f6
commit d72d3b7980
6 changed files with 39 additions and 45 deletions

View File

@@ -16,8 +16,8 @@ type Token struct {
// NewToken Token constructor
// TODO: return pointer
func NewToken(value []byte, startLine int, endLine int, startPos int, endPos int) Token {
return Token{string(value), startLine, endLine, startPos, endPos, nil}
func NewToken(value string, startLine int, endLine int, startPos int, endPos int) Token {
return Token{value, startLine, endLine, startPos, endPos, nil}
}
func (t Token) String() string {

View File

@@ -10,7 +10,7 @@ import (
)
func TestToken(t *testing.T) {
tkn := token.NewToken([]byte(`foo`), 1, 1, 0, 3)
tkn := token.NewToken(`foo`, 1, 1, 0, 3)
c := []comment.Comment{
comment.NewPlainComment("test comment"),