Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c645227

Browse files
committedFeb 27, 2019
sem: drop ImportDeclaration>[leadingComments trailingComments]
Signed-off-by: Alexander Bezzubov <[email protected]>
1 parent de29ab0 commit c645227

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
 

‎driver/normalizer/normalizer.go

+23
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,26 @@ var Preprocessors = []Mapping{
7474
uast.KeyType: String("ImportNamespaceSpecifier"),
7575
}),
7676
),
77+
// FIXME(bzz): make sure such comments are mapped properly
78+
Map(
79+
Part("_", Obj{
80+
uast.KeyType: String("ImportDeclaration"),
81+
"leadingComments": Any(),
82+
}),
83+
Part("_", Obj{
84+
uast.KeyType: String("ImportDeclaration"),
85+
}),
86+
),
87+
// FIXME(bzz): make sure such comments are mapped properly
88+
Map(
89+
Part("_", Obj{
90+
uast.KeyType: String("ImportDeclaration"),
91+
"trailingComments": Any(),
92+
}),
93+
Part("_", Obj{
94+
uast.KeyType: String("ImportDeclaration"),
95+
}),
96+
),
7797
}
7898

7999
// Normalizers is the main block of normalization rules to convert native AST to semantic UAST.
@@ -141,6 +161,9 @@ var Normalizers = []Mapping{
141161
"Path": Var("path"),
142162
},
143163
)),
164+
// importKind switch, set only by flow plugin
165+
// https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md#importdeclaration
166+
// TODO(bzz): this mapping misses 'typeof' case
144167
MapSemantic("ImportDeclaration", uast.Import{}, MapObj(
145168
CasesObj("case",
146169
// common

0 commit comments

Comments
 (0)
This repository has been archived.