Add {uselessCode} to some generator tests
The warning starts popping up if we move generator transpilation after checkControlFlow
AFAICT all the warnings are legitimate, and we're intentionally generating unreachable code in order to check that transpilation doesn't make it reachable.
@@ -711,6 +711,11 @@ function testGeneratorBlockScoped() {
assertUndefined(f);
}
+
+/**
+ * @suppress {uselessCode} The warning is accurate, but we're just testing
+ * that useless code is correctly transpiled and don't care.
+ */
function testTryCatchNoYield() {
var reached = false;
var reached2 = false;
@@ -732,12 +737,16 @@ function testTryCatchNoYield() {
}
function testLabels() {
+ /**
+ * @suppress {uselessCode} The warning is accurate, but we're just testing
+ * that useless code is correctly transpiled and don't care.
+ */
function*labeledBreakContinue() {
l1:
for (var i = 0; i < 3; i++) {
l2:
for (var j = 0; j < 3; j++) {
- for (var k = 0; k < 3; k++) {
+ for (var k = 0; k < 3; k++) { // k++ is unreachable
yield i + 3*j + 5*k;
if (k == 1) {
break l2;
@@ -777,11 +786,15 @@ function testGeneratorMethodThis() {
}
function testTryCatchSimpleYield() {
+ /**
+ * @suppress {uselessCode} The warning is accurate, but we're just testing
+ * that useless code is correctly transpiled and don't care.
+ */
function *tryCatch() {
try {
yield 1;
throw 2;
- yield 3;
+ yield 3; // unreachable
} catch (err) {
yield 4;
}
