diff options
| author | Marc Vertes <mvertes@free.fr> | 2024-03-14 14:37:32 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2024-03-14 14:37:32 +0100 |
| commit | 378683d25bdae89fa446b2b82f8dda5d6b34ea33 (patch) | |
| tree | cbf624e4eb38fafe51a12a718b48f43192cfcfac /vm/type.go | |
| parent | 60170bad25f912e0ba44e4c0095b54f6e26e307e (diff) | |
feat: initial support of closures
Also detection and automatic execution of main function.
Make sure that all debug is output to stderr.
Diffstat (limited to 'vm/type.go')
| -rw-r--r-- | vm/type.go | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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()} } |
