Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit aece00e

Browse files
committed
sem: drop ImportDeclaration>[leadingComments trailingComments]
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
1 parent b2ce4a1 commit aece00e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

driver/normalizer/normalizer.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,25 @@ var Normalizers = []Mapping{
137137
{Name: "source", Op: Var("path")},
138138
// empty un-used array
139139
{Name: "specifiers", Drop: true, Op: Arr()},
140+
// FIXME(bzz): make sure such comments are linked properly
141+
{Name: "leadingComments", Drop: true, Op: Any()},
142+
{Name: "trailingComments", Drop: true, Op: Any()},
140143
},
141144
Obj{
142145
"Path": Var("path"),
143146
},
144147
)),
148+
// importKind switch, set only by flow plugin
149+
// https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md#importdeclaration
150+
// TODO(bzz): this mapping misses 'typeof' case
145151
MapSemantic("ImportDeclaration", uast.Import{}, MapObj(
146152
CasesObj("case",
147153
// common
148-
Obj{
149-
"source": Var("path"),
154+
Fields{
155+
{Name: "source", Op: Var("path")},
156+
// FIXME(bzz): make sure such comments are linked properly
157+
{Name: "leadingComments", Drop: true, Op: Any()},
158+
{Name: "trailingComments", Drop: true, Op: Any()},
150159
},
151160
Objs{
152161
// namespace

0 commit comments

Comments
 (0)