summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
Diffstat (limited to 'vm')
-rw-r--r--vm/type.go4
-rw-r--r--vm/vm.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/vm/type.go b/vm/type.go
index 782aa28..644c106 100644
--- a/vm/type.go
+++ b/vm/type.go
@@ -95,8 +95,8 @@ func StructOf(fields []*Type) *Type {
return &Type{Rtype: reflect.StructOf(rf)}
}
-// FieldNameIndex returns the index of struct field name.
-func (t *Type) FieldNameIndex(name string) []int {
+// FieldIndex returns the index of struct field name.
+func (t *Type) FieldIndex(name string) []int {
for _, f := range reflect.VisibleFields(t.Rtype) {
if f.Name == name {
return f.Index
diff --git a/vm/vm.go b/vm/vm.go
index d035226..6472156 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -69,7 +69,7 @@ type Instruction struct {
}
func (i Instruction) String() (s string) {
- s = fmt.Sprintf("%4d: %v", i.Pos, i.Op)
+ s = fmt.Sprintf("%3d: %v", i.Pos, i.Op)
var sb strings.Builder
for _, a := range i.Arg {
sb.WriteString(fmt.Sprintf(" %v", a))
@@ -100,7 +100,7 @@ func (m *Machine) Run() (err error) {
sp = len(mem) // stack pointer
c := m.code[ip]
if debug {
- log.Printf("ip:%-4d sp:%-4d fp:%-4d op:[%-18v] mem:%v\n", ip, sp, fp, c, Vstring(mem))
+ log.Printf("ip:%-3d sp:%-3d fp:%-3d op:[%-20v] mem:%v\n", ip, sp, fp, c, Vstring(mem))
}
ic++
switch c.Op {