summaryrefslogtreecommitdiff
path: root/vm/type.go
diff options
context:
space:
mode:
Diffstat (limited to 'vm/type.go')
-rw-r--r--vm/type.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/vm/type.go b/vm/type.go
index d29de48..16e3733 100644
--- a/vm/type.go
+++ b/vm/type.go
@@ -26,6 +26,9 @@ type Value struct {
// NewValue returns an addressable zero value for the specified type.
func NewValue(typ *Type) Value {
+ if typ.Rtype.Kind() == reflect.Func {
+ typ = TypeOf(0) // Function value is its index in the code segment.
+ }
return Value{Type: typ, Data: reflect.New(typ.Rtype).Elem()}
}