Added an assertion to ensure export assignments for expression statements are only emitted for decorated clases.

This commit is contained in:
Daniel Rosenwasser 2016-04-14 12:31:12 -07:00
parent 482dfb61be
commit bce1a06c08

View File

@ -707,11 +707,14 @@ namespace ts {
return visitExpressionStatementForEnumOrNamespaceDeclaration(node, <EnumDeclaration | ModuleDeclaration>original);
}
else if (origKind === SyntaxKind.ClassDeclaration) {
// The decorated assignment for a class name will need to be transformed.
// The decorated assignment for a class name will potentially need to be transformed.
const classDecl = original as ClassDeclaration;
if (classDecl.name) {
const statements = [node];
addExportMemberAssignments(statements, classDecl.name);
if (statements.length > 1) {
Debug.assert(!!classDecl.decorators, "Expression statements should only have an export member assignment when decorated.")
}
return statements;
}
}