Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Simplify hasExportDeclarations (#27846)
  • Loading branch information
Andy Hanson authored and RyanCavanaugh committed Apr 25, 2019
1 parent 591b255 commit 9168bd4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/compiler/binder.ts
Expand Up @@ -1625,15 +1625,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 9168bd4

Please sign in to comment.