Refactored some of the functions

This commit is contained in:
obscuren
2014-05-20 19:28:48 +02:00
parent de1dfae717
commit 563c035eb5
2 changed files with 83 additions and 18 deletions

View File

@ -8,7 +8,6 @@ package main
import "C"
import (
"github.com/obscuren/otto"
"strings"
"unsafe"
)
@ -87,7 +86,10 @@ L:
}
}
func (self *JSRepl) PrintValue(value otto.Value) {
func (self *JSRepl) PrintValue(v interface{}) {
method, _ := self.re.vm.Get("prettyPrint")
method.Call(method, value)
v, err := self.re.vm.ToValue(v)
if err == nil {
method.Call(method, v)
}
}