mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
This reverts commit 26cb6ccce6
.
This commit is contained in:
parent
26cb6ccce6
commit
209b1fb8e8
|
@ -228,7 +228,7 @@ func Test_reflectStruct(t *testing.T) {
|
||||||
|
|
||||||
test(`
|
test(`
|
||||||
ret = abc.FuncReturn2();
|
ret = abc.FuncReturn2();
|
||||||
if (ret && ret.length && ret.length == 2 && ret[0] == "def" && ret[1] === null) {
|
if (ret && ret.length && ret.length == 2 && ret[0] == "def" && ret[1] === undefined) {
|
||||||
true;
|
true;
|
||||||
} else {
|
} else {
|
||||||
false;
|
false;
|
||||||
|
|
3
value.go
3
value.go
|
@ -325,7 +325,8 @@ func toValue(value interface{}) Value {
|
||||||
case _result:
|
case _result:
|
||||||
return Value{valueResult, value}
|
return Value{valueResult, value}
|
||||||
case nil:
|
case nil:
|
||||||
return nullValue
|
// TODO Ugh.
|
||||||
|
return Value{}
|
||||||
case reflect.Value:
|
case reflect.Value:
|
||||||
for value.Kind() == reflect.Ptr {
|
for value.Kind() == reflect.Ptr {
|
||||||
// We were given a pointer, so we'll drill down until we get a non-pointer
|
// We were given a pointer, so we'll drill down until we get a non-pointer
|
||||||
|
|
|
@ -39,8 +39,7 @@ func TestToValue(t *testing.T) {
|
||||||
vm := tester.vm
|
vm := tester.vm
|
||||||
|
|
||||||
value, _ := vm.ToValue(nil)
|
value, _ := vm.ToValue(nil)
|
||||||
is(value, "null")
|
is(value, "undefined")
|
||||||
is(value, nullValue)
|
|
||||||
|
|
||||||
value, _ = vm.ToValue((*byte)(nil))
|
value, _ = vm.ToValue((*byte)(nil))
|
||||||
is(value, "undefined")
|
is(value, "undefined")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user