Skip to content

Commit

Permalink
Simplify hasExportDeclarations
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hanson committed Oct 11, 2018
1 parent 4d504f9 commit 6ae0cd8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/compiler/binder.ts
Expand Up @@ -1569,15 +1569,8 @@ namespace ts {
}

function hasExportDeclarations(node: ModuleDeclaration | SourceFile): boolean {
const body = node.kind === SyntaxKind.SourceFile ? node : node.body;
if (body && (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock)) {
for (const stat of (<BlockLike>body).statements) {
if (stat.kind === SyntaxKind.ExportDeclaration || stat.kind === SyntaxKind.ExportAssignment) {
return true;
}
}
}
return false;
const body = isSourceFile(node) ? node : tryCast(node.body, isModuleBlock);
return !!body && body.statements.some(s => isExportDeclaration(s) || isExportAssignment(s));
}

function setExportContextFlag(node: ModuleDeclaration | SourceFile) {
Expand Down

0 comments on commit 6ae0cd8

Please sign in to comment.