Mercurial Hosting > luan
comparison core/src/luan/impl/LuanStateImpl.java @ 659:f1150518c467
remove tail recursion
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 05 Apr 2016 20:30:42 -0600 |
parents | e038905512d3 |
children | b438a47196bc |
comparison
equal
deleted
inserted
replaced
658:e038905512d3 | 659:f1150518c467 |
---|---|
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 private Frame frame = null; | 55 private Frame frame = null; |
56 public Object returnValues; | 56 public Object returnValues; |
57 Closure tailFn; | |
58 | 57 |
59 LuanStateImpl() {} | 58 LuanStateImpl() {} |
60 | 59 |
61 private LuanStateImpl(LuanStateImpl luan) { | 60 private LuanStateImpl(LuanStateImpl luan) { |
62 super(luan); | 61 super(luan); |
69 } | 68 } |
70 | 69 |
71 // returns stack | 70 // returns stack |
72 Object[] newFrame(Closure closure, int stackSize, Object[] varArgs) { | 71 Object[] newFrame(Closure closure, int stackSize, Object[] varArgs) { |
73 returnValues = LuanFunction.NOTHING; | 72 returnValues = LuanFunction.NOTHING; |
74 tailFn = null; | |
75 frame = new Frame(frame,closure,stackSize,varArgs); | 73 frame = new Frame(frame,closure,stackSize,varArgs); |
76 return frame.stack; | 74 return frame.stack; |
77 } | 75 } |
78 | 76 |
79 void popFrame() { | 77 void popFrame() { |
80 returnValues = LuanFunction.NOTHING; | 78 returnValues = LuanFunction.NOTHING; |
81 tailFn = null; | |
82 frame = frame.previousFrame; | 79 frame = frame.previousFrame; |
83 } | 80 } |
84 | 81 |
85 Object stackGet(int index) { | 82 Object stackGet(int index) { |
86 return frame.stack[index]; | 83 return frame.stack[index]; |