Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: pkg/analysis_server/tool/spec/codegen_matchers.dart

Issue 469673002: Add union types to the analysis server API spec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/tool/spec/codegen_java.dart ('k') | pkg/analysis_server/tool/spec/from_html.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/tool/spec/codegen_matchers.dart
diff --git a/pkg/analysis_server/tool/spec/codegen_matchers.dart b/pkg/analysis_server/tool/spec/codegen_matchers.dart
index e2e62fb949282959a9896098bef886a5e9e00185..d6de74b86104a8a9205e548fbd6d72e2427d1228 100644
--- a/pkg/analysis_server/tool/spec/codegen_matchers.dart
+++ b/pkg/analysis_server/tool/spec/codegen_matchers.dart
@@ -187,6 +187,20 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator {
void visitTypeReference(TypeReference typeReference) {
write(camelJoin(['is', typeReference.typeName]));
}
+
+ @override
+ void visitTypeUnion(TypeUnion typeUnion) {
+ bool commaNeeded = false;
+ write('isOneOf([');
+ for (TypeDecl choice in typeUnion.choices) {
+ if (commaNeeded) {
+ write(', ');
+ }
+ visitTypeDecl(choice);
+ commaNeeded = true;
+ }
+ write('])');
+ }
}
/**
« no previous file with comments | « pkg/analysis_server/tool/spec/codegen_java.dart ('k') | pkg/analysis_server/tool/spec/from_html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698