diff options
Diffstat (limited to 'symbol')
| -rw-r--r-- | symbol/kind_string.go | 19 | ||||
| -rw-r--r-- | symbol/symbol.go | 23 |
2 files changed, 22 insertions, 20 deletions
diff --git a/symbol/kind_string.go b/symbol/kind_string.go index 07dbd6a..61a745b 100644 --- a/symbol/kind_string.go +++ b/symbol/kind_string.go @@ -8,18 +8,19 @@ func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} - _ = x[Value-0] - _ = x[Type-1] - _ = x[Label-2] - _ = x[Const-3] - _ = x[Var-4] - _ = x[Func-5] - _ = x[Pkg-6] + _ = x[Unset-0] + _ = x[Value-1] + _ = x[Type-2] + _ = x[Label-3] + _ = x[Const-4] + _ = x[Var-5] + _ = x[Func-6] + _ = x[Pkg-7] } -const _Kind_name = "ValueTypeLabelConstVarFuncPkg" +const _Kind_name = "UnsetValueTypeLabelConstVarFuncPkg" -var _Kind_index = [...]uint8{0, 5, 9, 14, 19, 22, 26, 29} +var _Kind_index = [...]uint8{0, 5, 10, 14, 19, 24, 27, 31, 34} func (i Kind) String() string { idx := int(i) - 0 diff --git a/symbol/symbol.go b/symbol/symbol.go index e00b26d..96c860f 100644 --- a/symbol/symbol.go +++ b/symbol/symbol.go @@ -14,13 +14,14 @@ type Kind int // Symbol kinds. const ( - Value Kind = iota // a value defined in the runtime - Type // a type - Label // a label indicating a position in the VM code - Const // a constant - Var // a variable, located in the VM memory - Func // a function, located in the VM code - Pkg // a package + Unset Kind = iota + Value // a value defined in the runtime + Type // a type + Label // a label indicating a position in the VM code + Const // a constant + Var // a variable, located in the VM memory + Func // a function, located in the VM code + Pkg // a package ) //go:generate stringer -type=Kind @@ -97,10 +98,10 @@ func (sm SymMap) Init() { sm["int"] = &Symbol{Name: "int", Kind: Type, Index: UnsetAddr, Type: vm.TypeOf((*int)(nil)).Elem()} sm["string"] = &Symbol{Name: "string", Kind: Type, Index: UnsetAddr, Type: vm.TypeOf((*string)(nil)).Elem()} - sm["nil"] = &Symbol{Name: "nil", Index: UnsetAddr} + sm["nil"] = &Symbol{Name: "nil", Kind: Value, Index: UnsetAddr} sm["iota"] = &Symbol{Name: "iota", Kind: Const, Index: UnsetAddr} - sm["true"] = &Symbol{Name: "true", Index: UnsetAddr, Value: vm.ValueOf(true), Type: vm.TypeOf(true)} - sm["false"] = &Symbol{Name: "false", Index: UnsetAddr, Value: vm.ValueOf(false), Type: vm.TypeOf(false)} + sm["true"] = &Symbol{Name: "true", Kind: Value, Index: UnsetAddr, Value: vm.ValueOf(true), Type: vm.TypeOf(true)} + sm["false"] = &Symbol{Name: "false", Kind: Value, Index: UnsetAddr, Value: vm.ValueOf(false), Type: vm.TypeOf(false)} - sm["println"] = &Symbol{Name: "println", Index: UnsetAddr, Value: vm.ValueOf(func(v ...any) { fmt.Println(v...) })} + sm["println"] = &Symbol{Name: "println", Kind: Value, Index: UnsetAddr, Value: vm.ValueOf(func(v ...any) { fmt.Println(v...) })} } |
