Skip to content

Commit

Permalink
Merge pull request #9 from skuid/PLIN-3031-Condition_logic_fix
Browse files Browse the repository at this point in the history
PLIN-3031: allow negative index for 0-indexed array alignment
  • Loading branch information
acofer authored May 17, 2021
2 parents 3823eb1 + 3b215fd commit 1ad29e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions parse/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

// Index Op will index the left and right nodes
func (o *Op) Index(start uint) Node {
func (o *Op) Index(start int) Node {

var left Node
var right Node
Expand All @@ -26,9 +26,9 @@ func (o *Op) Index(start uint) Node {
}

// Index Leaf will add start to the current value
func (l *Leaf) Index(start uint) Node {
func (l *Leaf) Index(start int) Node {
return &Leaf{
Val: l.Val + start,
Val: uint(int(l.Val) + start),
}
}

Expand Down
2 changes: 1 addition & 1 deletion parse/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func TestIndex(t *testing.T) {
cases := []struct {
desc string
fixture Node
start uint
start int
expected Node
}{
{
Expand Down
2 changes: 1 addition & 1 deletion parse/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
type Node interface {
Remove(uint) Node
Eval(io.Writer) error
Index(uint) Node
Index(int) Node
}

// Leaf is a concrete Node that will hold a single value
Expand Down

0 comments on commit 1ad29e0

Please sign in to comment.