Skip to content

Commit 802e283

Browse files
committed
Refactoring of the builder
1 parent ae87838 commit 802e283

6 files changed

Lines changed: 225 additions & 293 deletions

File tree

src/compiler/utilities.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,10 @@ namespace ts {
13941394
return SpecialPropertyAssignmentKind.None;
13951395
}
13961396

1397+
export function isModuleWithStringLiteralName(node: Node): node is ModuleDeclaration {
1398+
return isModuleDeclaration(node) && node.name.kind === SyntaxKind.StringLiteral;
1399+
}
1400+
13971401
export function getExternalModuleName(node: Node): Expression {
13981402
if (node.kind === SyntaxKind.ImportDeclaration) {
13991403
return (<ImportDeclaration>node).moduleSpecifier;
@@ -1407,8 +1411,8 @@ namespace ts {
14071411
if (node.kind === SyntaxKind.ExportDeclaration) {
14081412
return (<ExportDeclaration>node).moduleSpecifier;
14091413
}
1410-
if (node.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral) {
1411-
return (<ModuleDeclaration>node).name;
1414+
if (isModuleWithStringLiteralName(node)) {
1415+
return node.name;
14121416
}
14131417
}
14141418

0 commit comments

Comments
 (0)