Index: pkg/analysis_server/tool/spec/api.dart |
diff --git a/pkg/analysis_server/tool/spec/api.dart b/pkg/analysis_server/tool/spec/api.dart |
index 5b70f1449015a9cb5b55ef7ab961454bd333842d..7c01e32f2914748eebdcf0f23161603bafa98015 100644 |
--- a/pkg/analysis_server/tool/spec/api.dart |
+++ b/pkg/analysis_server/tool/spec/api.dart |
@@ -17,6 +17,7 @@ import 'package:html5lib/dom.dart' as dom; |
*/ |
abstract class ApiVisitor<T> { |
T visitTypeReference(TypeReference typeReference); |
+ T visitTypeUnion(TypeUnion typeUnion); |
T visitTypeObject(TypeObject typeObject); |
T visitTypeList(TypeList typeList); |
T visitTypeMap(TypeMap typeMap); |
@@ -118,6 +119,11 @@ class HierarchicalApiVisitor extends ApiVisitor { |
void visitTypeReference(TypeReference typeReference) { |
} |
+ @override |
+ void visitTypeUnion(TypeUnion typeUnion) { |
+ typeUnion.choices.forEach(visitTypeDecl); |
+ } |
+ |
/** |
* If [type] is a [TypeReference] that is defined in the API, follow the |
* chain until a non-[TypeReference] is found, if possible. |
@@ -366,6 +372,17 @@ class TypeReference extends TypeDecl { |
} |
/** |
+ * Type which represents a union among multiple choices. |
+ */ |
+class TypeUnion extends TypeDecl { |
+ final List<TypeDecl> choices; |
+ |
+ TypeUnion(this.choices, dom.Element html) : super(html); |
+ |
+ accept(ApiVisitor visitor) => visitor.visitTypeUnion(this); |
+} |
+ |
+/** |
* Type of a JSON object with specified fields, some of which may be optional. |
*/ |
class TypeObject extends TypeDecl { |