opt out of tail recursion optimisation if the owner id has been reassigned - fixes #744
This commit is contained in:
13
test/fixtures/transformation/es6-tail-call/ignore-reassigned/actual.js
vendored
Normal file
13
test/fixtures/transformation/es6-tail-call/ignore-reassigned/actual.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// we need to deopt `test` if it's reassigned as we can't be certain of it's
|
||||
// state, ie. it could have been rebound or dereferenced
|
||||
|
||||
function test(exit) {
|
||||
if (exit) {
|
||||
return this.x;
|
||||
}
|
||||
return test(true);
|
||||
}
|
||||
|
||||
test = test.bind({ x: "yay" });
|
||||
|
||||
console.log(test());
|
||||
15
test/fixtures/transformation/es6-tail-call/ignore-reassigned/expected.js
vendored
Normal file
15
test/fixtures/transformation/es6-tail-call/ignore-reassigned/expected.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
// we need to deopt `test` if it's reassigned as we can't be certain of it's
|
||||
// state, ie. it could have been rebound or dereferenced
|
||||
|
||||
function test(exit) {
|
||||
if (exit) {
|
||||
return this.x;
|
||||
}
|
||||
return test(true);
|
||||
}
|
||||
|
||||
test = test.bind({ x: "yay" });
|
||||
|
||||
console.log(test());
|
||||
Reference in New Issue
Block a user