2018-05-11 01:44:48 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
////if (false) a;
|
|
|
|
////if (false) {
|
|
|
|
//// a;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////// No good way to delete just the 'if' part
|
|
|
|
////if (false) a; else b;
|
|
|
|
////if (false) {
|
|
|
|
//// a;
|
|
|
|
////} else {
|
|
|
|
//// b;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////while (false) a;
|
|
|
|
////while (false) {
|
|
|
|
//// a;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////for (let x = 0; false; ++x) a;
|
|
|
|
////for (let x = 0; false; ++x) {
|
|
|
|
//// a;
|
|
|
|
////}
|
2018-07-13 18:57:04 +02:00
|
|
|
////
|
|
|
|
////while (true) {
|
|
|
|
//// 1;
|
|
|
|
//// break;
|
|
|
|
//// 2;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////function f() {
|
|
|
|
//// if (true) {
|
|
|
|
//// 1;
|
|
|
|
//// return;
|
|
|
|
//// 2;
|
|
|
|
//// }
|
|
|
|
////}
|
2018-05-11 01:44:48 +02:00
|
|
|
|
|
|
|
verify.codeFixAll({
|
|
|
|
fixId: "fixUnreachableCode",
|
|
|
|
fixAllDescription: "Remove all unreachable code",
|
|
|
|
newFileContent:
|
|
|
|
`
|
|
|
|
// No good way to delete just the 'if' part
|
|
|
|
if (false) { } else b;
|
|
|
|
if (false) {
|
|
|
|
} else {
|
|
|
|
b;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-13 18:57:04 +02:00
|
|
|
|
|
|
|
while (true) {
|
|
|
|
1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
function f() {
|
|
|
|
if (true) {
|
|
|
|
1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}`,
|
2018-05-11 01:44:48 +02:00
|
|
|
});
|