Fixed invalid assertion in ts transformer

This commit is contained in:
Ron Buckton
2016-03-03 17:35:27 -08:00
parent 72eebdb4d4
commit 1cf183b09a

View File

@@ -2105,21 +2105,24 @@ namespace ts {
* This function will be called when one of the following conditions are met:
* - The node is exported from a TypeScript namespace.
*/
function visitVariableStatement(node: VariableStatement) {
Debug.assert(isNamespaceExport(node));
function visitVariableStatement(node: VariableStatement): Statement {
if (isNamespaceExport(node)) {
const variables = getInitializedVariables(node.declarationList);
if (variables.length === 0) {
// elide statement if there are no initialized variables.
return undefined;
}
const variables = getInitializedVariables(node.declarationList);
if (variables.length === 0) {
// elide statement if there are no initialized variables.
return undefined;
return createStatement(
inlineExpressions(
map(variables, transformInitializedVariable)
),
/*location*/ node
);
}
else {
return visitEachChild(node, visitor, context);
}
return createStatement(
inlineExpressions(
map(variables, transformInitializedVariable)
),
/*location*/ node
);
}
function transformInitializedVariable(node: VariableDeclaration): Expression {