forked from cerc-io/plugeth
internal/jsre: fix built-in inspect function
inspect was broken by ffaf58f0a9
(May 2016!).
Looks like nobody uses this function.
This commit is contained in:
parent
0ee796632a
commit
2be3c4b0e3
@ -71,7 +71,7 @@ func New(assetPath string, output io.Writer) *JSRE {
|
|||||||
}
|
}
|
||||||
go re.runEventLoop()
|
go re.runEventLoop()
|
||||||
re.Set("loadScript", re.loadScript)
|
re.Set("loadScript", re.loadScript)
|
||||||
re.Set("inspect", prettyPrintJS)
|
re.Set("inspect", re.prettyPrintJS)
|
||||||
return re
|
return re
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,10 +73,10 @@ func jsErrorString(err error) string {
|
|||||||
return err.Error()
|
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 {
|
for _, v := range call.ArgumentList {
|
||||||
prettyPrint(call.Otto, v, w)
|
prettyPrint(call.Otto, v, re.output)
|
||||||
fmt.Fprintln(w)
|
fmt.Fprintln(re.output)
|
||||||
}
|
}
|
||||||
return otto.UndefinedValue()
|
return otto.UndefinedValue()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user