Flow opaque type 6.x backport (#6081)

* Flow opaque type backport

* Add tests for strip types, comments, and babel-generator

* Fix failing tests, run scripts

* Bump babylon to 6.18.0
This commit is contained in:
jbrown215
2017-08-15 16:44:15 -04:00
committed by Henry Zhu
parent 2dba910b9e
commit c28465e03e
16 changed files with 353 additions and 78 deletions

View File

@@ -103,6 +103,14 @@ defineType("DeclareTypeAlias", {
}
});
defineType("DeclareOpaqueType", {
visitor: ["id", "typeParameters", "supertype"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
// todo
}
});
defineType("DeclareVariable", {
visitor: ["id"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
@@ -111,6 +119,14 @@ defineType("DeclareVariable", {
}
});
defineType("DeclareExportDeclaration", {
visitor: ["declaration", "specifiers", "source"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
// todo
},
});
defineType("ExistentialTypeParam", {
aliases: ["Flow"]
});
@@ -236,6 +252,14 @@ defineType("TypeAlias", {
}
});
defineType("OpaqueType", {
visitor: ["id", "typeParameters", "impltype", "supertype"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
// todo
}
});
defineType("TypeAnnotation", {
visitor: ["typeAnnotation"],
aliases: ["Flow"],

View File

@@ -70,6 +70,7 @@ getBindingIdentifiers.keys = {
DeclareVariable: ["id"],
InterfaceDeclaration: ["id"],
TypeAlias: ["id"],
OpaqueType: ["id"],
CatchClause: ["param"],
LabeledStatement: ["label"],