|
@@ -18,6 +18,7 @@ const (
|
|
|
|
|
|
var (
|
|
var (
|
|
typeCallable = reflect.TypeOf(Callable(nil))
|
|
typeCallable = reflect.TypeOf(Callable(nil))
|
|
|
|
+ typeValue = reflect.TypeOf((*Value)(nil)).Elem()
|
|
)
|
|
)
|
|
|
|
|
|
type global struct {
|
|
type global struct {
|
|
@@ -1121,6 +1122,10 @@ func (r *Runtime) toReflectValue(v Value, typ reflect.Type) (reflect.Value, erro
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if typ.Implements(typeValue) {
|
|
|
|
+ return reflect.ValueOf(v), nil
|
|
|
|
+ }
|
|
|
|
+
|
|
et := v.ExportType()
|
|
et := v.ExportType()
|
|
if et == nil {
|
|
if et == nil {
|
|
return reflect.Zero(typ), nil
|
|
return reflect.Zero(typ), nil
|
|
@@ -1131,13 +1136,6 @@ func (r *Runtime) toReflectValue(v Value, typ reflect.Type) (reflect.Value, erro
|
|
return reflect.ValueOf(v.Export()).Convert(typ), nil
|
|
return reflect.ValueOf(v.Export()).Convert(typ), nil
|
|
}
|
|
}
|
|
|
|
|
|
- t := reflect.TypeOf(v)
|
|
|
|
- if t.AssignableTo(typ) {
|
|
|
|
- return reflect.ValueOf(v), nil
|
|
|
|
- } else if t.ConvertibleTo(typ) {
|
|
|
|
- return reflect.ValueOf(v).Convert(typ), nil
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
switch typ.Kind() {
|
|
switch typ.Kind() {
|
|
case reflect.Slice:
|
|
case reflect.Slice:
|
|
if o, ok := v.(*Object); ok {
|
|
if o, ok := v.(*Object); ok {
|