Skip to content

Commit

Permalink
fix bug index assignment missing deref
Browse files Browse the repository at this point in the history
  • Loading branch information
ldemailly committed Sep 3, 2024
1 parent fb4ebd9 commit ef07d3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion eval/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func (s *State) evalIndexAssigment(which ast.Node, index, value object.Object) o
if !ok {
return s.NewError("identifier not found: " + id.Literal())
}
val = object.Value(val) // deref.
switch val.Type() {
case object.ARRAY:
if index.Type() != object.INTEGER {
Expand Down Expand Up @@ -497,7 +498,7 @@ func evalMapIndexExpression(assoc, key object.Object) object.Object {
if !ok {
return object.NULL
}
return v
return v // already unwrapped (index has been Eval'ed)
}

func evalArrayIndexExpression(array, index object.Object) object.Object {
Expand Down

0 comments on commit ef07d3f

Please sign in to comment.