summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/flow.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/flow.js')
-rw-r--r--tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/flow.js39
1 files changed, 23 insertions, 16 deletions
diff --git a/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/flow.js b/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/flow.js
index 2f245af4a8..e1f95be3ee 100644
--- a/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/flow.js
+++ b/tools/node_modules/eslint/node_modules/@babel/generator/lib/generators/flow.js
@@ -335,7 +335,8 @@ function FunctionTypeAnnotation(node, parent) {
this.print(node.rest, node);
}
this.tokenChar(41);
- if (parent && (parent.type === "ObjectTypeCallProperty" || parent.type === "ObjectTypeInternalSlot" || parent.type === "DeclareFunction" || parent.type === "ObjectTypeProperty" && parent.method)) {
+ const type = parent == null ? void 0 : parent.type;
+ if (type != null && (type === "ObjectTypeCallProperty" || type === "ObjectTypeInternalSlot" || type === "DeclareFunction" || type === "ObjectTypeProperty" && parent.method)) {
this.tokenChar(58);
} else {
this.space();
@@ -367,26 +368,31 @@ function _interfaceish(node) {
this.space();
this.printList(node.extends, node);
}
- if (node.mixins && node.mixins.length) {
- this.space();
- this.word("mixins");
- this.space();
- this.printList(node.mixins, node);
- }
- if (node.implements && node.implements.length) {
- this.space();
- this.word("implements");
- this.space();
- this.printList(node.implements, node);
+ if (node.type === "DeclareClass") {
+ var _node$mixins, _node$implements;
+ if ((_node$mixins = node.mixins) != null && _node$mixins.length) {
+ this.space();
+ this.word("mixins");
+ this.space();
+ this.printList(node.mixins, node);
+ }
+ if ((_node$implements = node.implements) != null && _node$implements.length) {
+ this.space();
+ this.word("implements");
+ this.space();
+ this.printList(node.implements, node);
+ }
}
this.space();
this.print(node.body, node);
}
function _variance(node) {
- if (node.variance) {
- if (node.variance.kind === "plus") {
+ var _node$variance;
+ const kind = (_node$variance = node.variance) == null ? void 0 : _node$variance.kind;
+ if (kind != null) {
+ if (kind === "plus") {
this.tokenChar(43);
- } else if (node.variance.kind === "minus") {
+ } else if (kind === "minus") {
this.tokenChar(45);
}
}
@@ -402,8 +408,9 @@ function andSeparator() {
this.space();
}
function InterfaceTypeAnnotation(node) {
+ var _node$extends2;
this.word("interface");
- if (node.extends && node.extends.length) {
+ if ((_node$extends2 = node.extends) != null && _node$extends2.length) {
this.space();
this.word("extends");
this.space();