mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-10-27 07:41:52 +03:00
ec37b77b6e
Summary: Follow-up to https://github.com/facebook/prepack/pull/2212. Pull Request resolved: https://github.com/facebook/prepack/pull/2234 Differential Revision: D8788834 Pulled By: gaearon fbshipit-source-id: 08937736bed3df0ea13d5e7a3925fb2f58633d5c
25 lines
730 B
JavaScript
25 lines
730 B
JavaScript
// recover-from-errors
|
|
// expected errors: [{location: {"start":{"line":17,"column":14},"end":{"line":17,"column":16 },"identifierName":"n1","source":"test/error-handler/conditional-return.js"}, errorCode: "PP0002", severity: "RecoverableError", message: "might be an object with an unknown valueOf or toString or Symbol.toPrimitive method"}]
|
|
let b = global.__abstract ? __abstract("boolean", "true") : true;
|
|
let n1;
|
|
if (b) n1 = 5;
|
|
let n2 = global.__abstract ? __abstract("number", "7") : 7;
|
|
|
|
function f() {
|
|
if (!b) return;
|
|
// should not fail
|
|
return n2 - n1;
|
|
}
|
|
|
|
function g() {
|
|
f();
|
|
//condition from line 7 should have been undone and this should fail.
|
|
return n2 - n1;
|
|
}
|
|
|
|
g();
|
|
|
|
inspect = function() {
|
|
return true;
|
|
};
|