mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-10-05 19:07:43 +03:00
Test cases of resolved issues (#2614)
Summary: Release Notes: None Went through optimized functions issues looking for ones that have already been resolved and not closed. These were the only ones I found that didn't have a corresponding PR adding a test case linked from the issue. Pull Request resolved: https://github.com/facebook/prepack/pull/2614 Differential Revision: D10516188 Pulled By: cblappert fbshipit-source-id: aaf23d3aa857cc495b804fb1e05c2cb4955fd85f
This commit is contained in:
parent
683bb2a280
commit
217868ba09
16
test/serializer/optimized-functions/Issue1640ImplicitThis.js
Normal file
16
test/serializer/optimized-functions/Issue1640ImplicitThis.js
Normal file
@ -0,0 +1,16 @@
|
||||
(function() {
|
||||
function f(x) {
|
||||
this.x = 5 + x;
|
||||
var self = this;
|
||||
this.doSomething = function(y) {
|
||||
return self.x + y;
|
||||
};
|
||||
}
|
||||
|
||||
if (global.__optimize) __optimize(f);
|
||||
|
||||
global.inspect = function() {
|
||||
var obj = new f(10);
|
||||
return obj.doSomething(20);
|
||||
};
|
||||
})();
|
26
test/serializer/optimized-functions/Issue2388.js
Normal file
26
test/serializer/optimized-functions/Issue2388.js
Normal file
@ -0,0 +1,26 @@
|
||||
var foo;
|
||||
(function() {
|
||||
function f() {
|
||||
let x = 23;
|
||||
function g() {
|
||||
x = x + 1;
|
||||
// x doesn't leak here
|
||||
}
|
||||
function h(gg) {
|
||||
function hh() {
|
||||
x = x + 1;
|
||||
}
|
||||
gg(hh); // leaks x
|
||||
}
|
||||
global.__optimize && __optimize(g);
|
||||
global.__optimize && __optimize(h);
|
||||
return [g, h];
|
||||
}
|
||||
global.__optimize && __optimize(f);
|
||||
foo = f;
|
||||
})();
|
||||
|
||||
global.inspect = function() {
|
||||
let [g, h] = foo();
|
||||
return h(g);
|
||||
};
|
Loading…
Reference in New Issue
Block a user