Support changes in flow parsing

This commit is contained in:
Henry Zhu 2016-06-08 13:07:54 -04:00
parent dc525edf51
commit ad0e1ba6de
2 changed files with 14 additions and 10 deletions

View File

@ -187,6 +187,20 @@ export function TypeAnnotation(node: Object) {
this.print(node.typeAnnotation, node);
}
export function TypeParameter(node: Object) {
if (node.variance === "plus") {
this.push("+");
} else if (node.variance === "minus") {
this.push("-");
}
this.push(node.name);
if (node.bound) {
this.print(node.bound, node);
}
}
export function TypeParameterInstantiation(node: Object) {
this.push("<");
this.printJoin(node.params, node, {

View File

@ -4,16 +4,6 @@
import * as t from "babel-types";
export function Identifier(node: Object) {
// FIXME: We hang variance off Identifer to support Flow's def-site variance.
// This is a terrible hack, but changing type annotations to use a new,
// dedicated node would be a breaking change. This should be cleaned up in
// the next major.
if (node.variance === "plus") {
this.push("+");
} else if (node.variance === "minus") {
this.push("-");
}
this.push(node.name);
}