summaryrefslogtreecommitdiff
path: root/parser/compiler.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2024-06-30 15:23:02 +0200
committerMarc Vertes <mvertes@free.fr>2024-06-30 15:23:02 +0200
commit0ad649db1e886f98002f4d90488a8e4adbac3de8 (patch)
tree32be6a4cecf83487dd6a91e8a9aa1da709840b0f /parser/compiler.go
parent4acaa8e1630a359117d535a20b0af9554058d1e3 (diff)
improve parser errorsfix-untyped-assign
Diffstat (limited to 'parser/compiler.go')
-rw-r--r--parser/compiler.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/parser/compiler.go b/parser/compiler.go
index aa16888..05462eb 100644
--- a/parser/compiler.go
+++ b/parser/compiler.go
@@ -268,7 +268,7 @@ func (c *Compiler) Codegen(tokens Tokens) (err error) {
} else {
i = s.value.Data.Int() - int64(len(c.Code))
}
- emit(int64(t.Pos), vm.JumpSetTrue, int64(i))
+ emit(int64(t.Pos), vm.JumpSetTrue, i)
case lang.Goto:
var i int64
@@ -440,17 +440,17 @@ type DumpValue struct {
// This design choice allows the Virtual Machine (VM) to evolve its memory management strategies
// without compromising backward compatibility with dumps generated by previous versions.
func (c *Compiler) Dump() *Dump {
- var dv []*DumpValue
dict := c.symbolsByIndex()
+ dv := make([]*DumpValue, len(c.Data))
for i, d := range c.Data {
e := dict[i]
- dv = append(dv, &DumpValue{
+ dv[i] = &DumpValue{
Index: e.index,
Name: e.name,
Kind: int(e.kind),
Type: e.Type.Name,
Value: d.Data.Interface(),
- })
+ }
}
return &Dump{Values: dv}