indexes
Some checks failed
Build / build (push) Failing after 5m57s
Test / build (push) Failing after 5m41s

This commit is contained in:
Chuck Smith
2024-02-27 16:45:22 -05:00
parent 0a1201f1bc
commit 4185926e3e
5 changed files with 116 additions and 0 deletions

View File

@@ -227,6 +227,19 @@ func (c *Compiler) Compile(node ast.Node) error {
c.emit(code.OpHash, len(node.Pairs)*2)
case *ast.IndexExpression:
err := c.Compile(node.Left)
if err != nil {
return err
}
err = c.Compile(node.Index)
if err != nil {
return err
}
c.emit(code.OpIndex)
}
return nil