Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
49703bea
Commit
49703bea
authored
Aug 15, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jsre: bind the pretty printer to "inspect" in JS
parent
5c5c3930
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
jsre.go
jsre/jsre.go
+1
-0
pretty.go
jsre/pretty.go
+8
-0
No files found.
jsre/jsre.go
View file @
49703bea
...
...
@@ -66,6 +66,7 @@ func New(assetPath string) *JSRE {
re
.
loopWg
.
Add
(
1
)
go
re
.
runEventLoop
()
re
.
Set
(
"loadScript"
,
re
.
loadScript
)
re
.
Set
(
"inspect"
,
prettyPrintJS
)
return
re
}
...
...
jsre/pretty.go
View file @
49703bea
...
...
@@ -54,6 +54,14 @@ func prettyPrint(vm *otto.Otto, value otto.Value) {
ppctx
{
vm
}
.
printValue
(
value
,
0
)
}
func
prettyPrintJS
(
call
otto
.
FunctionCall
)
otto
.
Value
{
for
_
,
v
:=
range
call
.
ArgumentList
{
prettyPrint
(
call
.
Otto
,
v
)
fmt
.
Println
()
}
return
otto
.
UndefinedValue
()
}
type
ppctx
struct
{
vm
*
otto
.
Otto
}
func
(
ctx
ppctx
)
indent
(
level
int
)
string
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment