Fix repl feedback
This commit is contained in:
10
repl/repl.go
10
repl/repl.go
@@ -164,7 +164,7 @@ func (r *REPL) StartEvalLoop(in io.Reader, out io.Writer, env *object.Environmen
|
||||
}
|
||||
|
||||
obj := evaluator.Eval(program, env)
|
||||
if obj != nil {
|
||||
if _, ok := obj.(*object.Null); !ok {
|
||||
io.WriteString(out, obj.Inspect())
|
||||
io.WriteString(out, "\n")
|
||||
}
|
||||
@@ -216,9 +216,11 @@ func (r *REPL) StartExecLoop(in io.Reader, out io.Writer, state *VMState) {
|
||||
return
|
||||
}
|
||||
|
||||
stackTop := machine.LastPoppedStackElem()
|
||||
io.WriteString(out, stackTop.Inspect())
|
||||
io.WriteString(out, "\n")
|
||||
obj := machine.LastPoppedStackElem()
|
||||
if _, ok := obj.(*object.Null); !ok {
|
||||
io.WriteString(out, obj.Inspect())
|
||||
io.WriteString(out, "\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user