Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
lisp
lingo
Commits
53385e11
Commit
53385e11
authored
Jun 30, 2017
by
Juergen Nickelsen
Browse files
don't print env[0]'s bindings in stack trace
These made the stack trace unreadble and were not particularly helpful.
parent
aecdd8b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
eval/eval.go
View file @
53385e11
...
...
@@ -39,15 +39,19 @@ func EvalLevel() int {
func
printEnv
(
env
*
lob
.
Environment
)
string
{
buf
:=
bytes
.
NewBufferString
(
env
.
ValueString
(
nil
))
buf
.
WriteRune
(
'{'
)
first
:=
true
for
key
,
value
:=
range
env
.
Varmap
()
{
if
!
first
{
buf
.
WriteString
(
"; "
)
if
env
.
Level
()
==
0
{
buf
.
WriteString
(
"..."
)
}
else
{
first
:=
true
for
key
,
value
:=
range
env
.
Varmap
()
{
if
!
first
{
buf
.
WriteString
(
"; "
)
}
buf
.
WriteString
(
key
.
ValueString
(
nil
))
buf
.
WriteRune
(
'='
)
buf
.
WriteString
(
value
.
ValueString
(
nil
))
first
=
false
}
buf
.
WriteString
(
key
.
ValueString
(
nil
))
buf
.
WriteRune
(
'='
)
buf
.
WriteString
(
value
.
ValueString
(
nil
))
first
=
false
}
buf
.
WriteRune
(
'}'
)
return
buf
.
String
()
...
...
@@ -58,7 +62,7 @@ func printEnv(env *lob.Environment) string {
func
PrintStack
()
{
for
i
:=
0
;
i
<
len
(
evalStack
);
i
+=
2
{
// take care to indent the environment line as appropriate
levelStr
:=
fmt
.
Sprintf
(
"
#
%d "
,
i
/
2
)
levelStr
:=
fmt
.
Sprintf
(
"
:
%d "
,
i
/
2
)
fmt
.
Printf
(
"%s%s
\n
%*s%s
\n
"
,
levelStr
,
evalStack
[
i
],
len
(
levelStr
),
""
,
printEnv
(
evalStack
[
i
+
1
]
.
(
*
lob
.
Environment
)))
...
...
lob/environment.go
View file @
53385e11
...
...
@@ -101,6 +101,10 @@ func (env *Environment) Varmap() VarMap {
return
env
.
val
}
func
(
env
*
Environment
)
Level
()
int
{
return
env
.
level
}
func
(
env
*
Environment
)
Vars
(
noparents
bool
)
Object
{
vars
:=
env
.
allvarmap
(
noparents
)
var
result
Object
=
Nil
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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