From bce1a06c0826e2ceb7c03f986822501812076849 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 14 Apr 2016 12:31:12 -0700 Subject: [PATCH] Added an assertion to ensure export assignments for expression statements are only emitted for decorated clases. --- src/compiler/transformers/module/module.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 7599281e142..5d789ed6280 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -707,11 +707,14 @@ namespace ts { return visitExpressionStatementForEnumOrNamespaceDeclaration(node, 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; } }