Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit 5b6632d

Browse files
committed
fix: mark nodes as directives in module and namespaces
1 parent 6e96dc8 commit 5b6632d

File tree

5 files changed

+943
-1
lines changed

5 files changed

+943
-1
lines changed

src/convert.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,8 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
16541654
type: AST_NODE_TYPES.TSModuleBlock,
16551655
body: node.statements.map(convertChild)
16561656
});
1657+
1658+
convertBodyExpressionsToDirectives();
16571659
break;
16581660

16591661
case SyntaxKind.ImportDeclaration:

tests/ast-alignment/fixtures-to-test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,17 @@ let fixturePatternConfigsToTest = [
387387
* Babel: BooleanLiteral
388388
* tsep: Literal
389389
*/
390-
'typed-keyword-false'
390+
'typed-keyword-false',
391+
/**
392+
* Not yet supported in Babel https://github.com/babel/babel/issues/9228
393+
* Directive field is not added to module and namespace
394+
*/
395+
'directive-in-module',
396+
/**
397+
* Not yet supported in Babel https://github.com/babel/babel/issues/9228
398+
* Directive field is not added to module and namespace
399+
*/
400+
'directive-in-namespace'
391401
],
392402
ignoreSourceType: [
393403
// https://github.com/babel/babel/issues/9213
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module foo {
2+
"use strict";
3+
var a = 1;
4+
"use strict";
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace foo {
2+
"use strict";
3+
var a = 1;
4+
"use strict";
5+
}

0 commit comments

Comments
 (0)