Permalink
Browse files

fix: Interpreter#evaluate should reset call_stack

fix #122
  • Loading branch information...
yhara committed Nov 17, 2018
1 parent a8dcc24 commit 405e1a120a305828a2fe194d5af9b57121f7d0a1
Showing with 8 additions and 0 deletions.
  1. +1 −0 src/system/interpreter.js
  2. +7 −0 test/unit.js
@@ -402,6 +402,7 @@ BiwaScheme.Interpreter = BiwaScheme.Class.create({
// Compile and evaluate Scheme program
evaluate: function(str, after_evaluate){
this.call_stack = [];
this.parser = new BiwaScheme.Parser(str);
this.compiler = new BiwaScheme.Compiler();
if(after_evaluate)
@@ -141,6 +141,13 @@ describe('Interpreter', {
expect( BiwaScheme.inspect(intp.call_stack) ).should_be('[]');
},
'stack trace (reset on errors)': function(){
var intp = new BiwaScheme.Interpreter();
intp.evaluate("((lambda () a))");
intp.evaluate("((lambda () a))");
expect( BiwaScheme.inspect(intp.call_stack) ).should_be('["(anon)"]');
},
'define_scmfunc': function() {
BiwaScheme.define_scmfunc('scmfunc-test', 1, 1,
"(lambda (n) \

0 comments on commit 405e1a1

Please sign in to comment.