internal/jsre: fix built-in inspect function

inspect was broken by ffaf58f0a9 (May 2016!).
Looks like nobody uses this function.
pull/3475/head
Felix Lange 8 years ago
parent 0ee796632a
commit 2be3c4b0e3
  1. 2
      internal/jsre/jsre.go
  2. 6
      internal/jsre/pretty.go

@ -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()
}

Loading…
Cancel
Save