Open rrthomas opened 9 months ago
Why only if we're calling the current function?
The situation has changed. For the reference interpreter it may be a good idea to eliminate tail calls, but it's less urgent. The worst we can do is exhaust memory (that stack will be on the heap).
ES2015 has tail calls in strict mode; we should ensure we're using this where possible.
Add an exception
ArkTailCall
that replacesArkCall
for tail calls. Use it whenever we're in tail position, which we'll track with another argument totoAST
, which istrue
when the parent is in tail position. Then if we're in tail position and our parent is and we're calling the current function (another new argument totoAST
) then useArkTailCall
instead ofArkCall
.