Pointer cleanup (#78)

Remove unnecessary pointer receivers for Position and QueryResult
This commit is contained in:
Sam Broughton
2016-07-21 15:42:51 +01:00
committed by Thomas Pelletier
parent 64ff1ea4d5
commit 65ad89c1a7
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -18,12 +18,12 @@ type Position struct {
// String representation of the position.
// Displays 1-indexed line and column numbers.
func (p *Position) String() string {
func (p Position) String() string {
return fmt.Sprintf("(%d, %d)", p.Line, p.Col)
}
// Invalid returns whether or not the position is valid (i.e. with negative or
// null values)
func (p *Position) Invalid() bool {
func (p Position) Invalid() bool {
return p.Line <= 0 || p.Col <= 0
}
+2 -2
View File
@@ -30,7 +30,7 @@ func (r *QueryResult) appendResult(node interface{}, pos Position) {
// Values is a set of values within a QueryResult. The order of values is not
// guaranteed to be in document order, and may be different each time a query is
// executed.
func (r *QueryResult) Values() []interface{} {
func (r QueryResult) Values() []interface{} {
values := make([]interface{}, len(r.items))
for i, v := range r.items {
o, ok := v.(*tomlValue)
@@ -45,7 +45,7 @@ func (r *QueryResult) Values() []interface{} {
// Positions is a set of positions for values within a QueryResult. Each index
// in Positions() corresponds to the entry in Value() of the same index.
func (r *QueryResult) Positions() []Position {
func (r QueryResult) Positions() []Position {
return r.positions
}