mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-10-27 07:41:52 +03:00
2334d329d1
Summary: Follow up to #2219 This also includes two relevant bonus fixes:2aa1ad35a4
ande96ac8c0c1
Pull Request resolved: https://github.com/facebook/prepack/pull/2329 Differential Revision: D9033950 Pulled By: sebmarkbage fbshipit-source-id: b28b608b7449f0bbd7781c7d6aab5717d638d904
39 lines
734 B
JavaScript
39 lines
734 B
JavaScript
let s = global.__abstract ? __abstract("string", "('foo')") : "foo";
|
|
|
|
function test(c) {
|
|
let read = false;
|
|
let read2 = false;
|
|
let write = false;
|
|
let write2 = false;
|
|
let knownObj = {
|
|
get foo() {
|
|
read = true;
|
|
return 1;
|
|
},
|
|
set foo(v) {
|
|
write = true;
|
|
},
|
|
};
|
|
let knownObj2 = {
|
|
get foo() {
|
|
read2 = true;
|
|
return 2;
|
|
},
|
|
set foo(v) {
|
|
write2 = true;
|
|
},
|
|
};
|
|
let conditionalObj = c ? knownObj : knownObj2;
|
|
conditionalObj[s] = 3;
|
|
let value = conditionalObj[s];
|
|
return "Value: " + value + " Touched: " + read + " " + read2 + "Written: " + write + " " + write2;
|
|
}
|
|
|
|
if (global.__optimize) {
|
|
__optimize(test);
|
|
}
|
|
|
|
inspect = function() {
|
|
return test(true);
|
|
};
|