Pointer cleanup (#78)
Remove unnecessary pointer receivers for Position and QueryResult
This commit is contained in:
committed by
Thomas Pelletier
parent
64ff1ea4d5
commit
65ad89c1a7
+2
-2
@@ -18,12 +18,12 @@ type Position struct {
|
|||||||
|
|
||||||
// String representation of the position.
|
// String representation of the position.
|
||||||
// Displays 1-indexed line and column numbers.
|
// 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)
|
return fmt.Sprintf("(%d, %d)", p.Line, p.Col)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalid returns whether or not the position is valid (i.e. with negative or
|
// Invalid returns whether or not the position is valid (i.e. with negative or
|
||||||
// null values)
|
// null values)
|
||||||
func (p *Position) Invalid() bool {
|
func (p Position) Invalid() bool {
|
||||||
return p.Line <= 0 || p.Col <= 0
|
return p.Line <= 0 || p.Col <= 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
// 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
|
// guaranteed to be in document order, and may be different each time a query is
|
||||||
// executed.
|
// executed.
|
||||||
func (r *QueryResult) Values() []interface{} {
|
func (r QueryResult) Values() []interface{} {
|
||||||
values := make([]interface{}, len(r.items))
|
values := make([]interface{}, len(r.items))
|
||||||
for i, v := range r.items {
|
for i, v := range r.items {
|
||||||
o, ok := v.(*tomlValue)
|
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
|
// 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.
|
// 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
|
return r.positions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user