Commit 2be3c4b0 authored by Felix Lange's avatar Felix Lange

internal/jsre: fix built-in inspect function

inspect was broken by ffaf58f0 (May 2016!).
Looks like nobody uses this function.
parent 0ee79663
......@@ -71,7 +71,7 @@ func New(assetPath string, output io.Writer) *JSRE {
}
go re.runEventLoop()
re.Set("loadScript", re.loadScript)
re.Set("inspect", prettyPrintJS)
re.Set("inspect", re.prettyPrintJS)
return re
}
......
......@@ -73,10 +73,10 @@ func jsErrorString(err error) string {
return err.Error()
}
func prettyPrintJS(call otto.FunctionCall, w io.Writer) otto.Value {
func (re *JSRE) prettyPrintJS(call otto.FunctionCall) otto.Value {
for _, v := range call.ArgumentList {
prettyPrint(call.Otto, v, w)
fmt.Fprintln(w)
prettyPrint(call.Otto, v, re.output)
fmt.Fprintln(re.output)
}
return otto.UndefinedValue()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment