Add semicolon to unused class member list

Turns out SemicolonClassElement is a specific kind for semicolons inside
a class. Having one of them with --noUnusedLocals on would crash the
compiler after the assert added in #21013.
This commit is contained in:
Nathan Shively-Sanders 2018-01-22 12:59:53 -08:00
parent 588716926d
commit 97fb0fd55f
5 changed files with 32 additions and 0 deletions

View file

@ -21030,6 +21030,7 @@ namespace ts {
}
break;
case SyntaxKind.IndexSignature:
case SyntaxKind.SemicolonClassElement:
// Can't be private
break;
default:

View file

@ -0,0 +1,13 @@
//// [unusedSemicolonInClass.ts]
class Unused {
;
}
//// [unusedSemicolonInClass.js]
var Unused = /** @class */ (function () {
function Unused() {
}
;
return Unused;
}());

View file

@ -0,0 +1,7 @@
=== tests/cases/compiler/unusedSemicolonInClass.ts ===
class Unused {
>Unused : Symbol(Unused, Decl(unusedSemicolonInClass.ts, 0, 0))
;
}

View file

@ -0,0 +1,7 @@
=== tests/cases/compiler/unusedSemicolonInClass.ts ===
class Unused {
>Unused : Unused
;
}

View file

@ -0,0 +1,4 @@
// @noUnusedLocals: true
class Unused {
;
}