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

Side by Side Diff: pkg/analyzer_plugin/tool/spec/codegen_matchers.dart

Issue 2876023003: Allow the common spec types to be in a separate document (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Code generation for the file "matchers.dart". 6 * Code generation for the file "matchers.dart".
7 */ 7 */
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:analyzer/src/codegen/tools.dart'; 10 import 'package:analyzer/src/codegen/tools.dart';
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 visitApi() { 99 visitApi() {
100 outputHeader(year: '2017'); 100 outputHeader(year: '2017');
101 writeln(); 101 writeln();
102 writeln('/**'); 102 writeln('/**');
103 writeln(' * Matchers for data types defined in the analysis server API'); 103 writeln(' * Matchers for data types defined in the analysis server API');
104 writeln(' */'); 104 writeln(' */');
105 writeln("import 'package:test/test.dart';"); 105 writeln("import 'package:test/test.dart';");
106 writeln(); 106 writeln();
107 writeln("import 'integration_tests.dart';"); 107 writeln("import 'integration_tests.dart';");
108 writeln(); 108 writeln();
109 for (ImpliedType impliedType in computeImpliedTypes(api).values) { 109 List<ImpliedType> impliedTypes = computeImpliedTypes(api).values.toList();
110 impliedTypes.sort((ImpliedType first, ImpliedType second) =>
111 first.camelName.compareTo(second.camelName));
112 for (ImpliedType impliedType in impliedTypes) {
110 makeMatcher(impliedType); 113 makeMatcher(impliedType);
111 } 114 }
112 } 115 }
113 116
114 @override 117 @override
115 visitTypeEnum(TypeEnum typeEnum) { 118 visitTypeEnum(TypeEnum typeEnum) {
116 writeln('new MatchesEnum(${JSON.encode(context)}, ['); 119 writeln('new MatchesEnum(${JSON.encode(context)}, [');
117 indent(() { 120 indent(() {
118 bool commaNeeded = false; 121 bool commaNeeded = false;
119 for (TypeEnumValue value in typeEnum.values) { 122 for (TypeEnumValue value in typeEnum.values) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 for (TypeDecl choice in typeUnion.choices) { 182 for (TypeDecl choice in typeUnion.choices) {
180 if (commaNeeded) { 183 if (commaNeeded) {
181 write(', '); 184 write(', ');
182 } 185 }
183 visitTypeDecl(choice); 186 visitTypeDecl(choice);
184 commaNeeded = true; 187 commaNeeded = true;
185 } 188 }
186 write('])'); 189 write('])');
187 } 190 }
188 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698