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

Side by Side Diff: pkg/analysis_server/tool/spec/codegen_inttest_methods.dart

Issue 2233633003: Convert to async/await parts that cause strong mode warnings. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/test/search/type_hierarchy_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "integration_test_methods.dart". 6 * Code generation for the file "integration_test_methods.dart".
7 */ 7 */
8 library codegenInttestMethods; 8 library codegenInttestMethods;
9 9
10 import 'dart:convert'; 10 import 'dart:convert';
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 })); 218 }));
219 String resultClass; 219 String resultClass;
220 String futureClass; 220 String futureClass;
221 if (request.result == null) { 221 if (request.result == null) {
222 futureClass = 'Future'; 222 futureClass = 'Future';
223 } else { 223 } else {
224 resultClass = camelJoin([request.domainName, request.method, 'result'], 224 resultClass = camelJoin([request.domainName, request.method, 'result'],
225 doCapitalize: true); 225 doCapitalize: true);
226 futureClass = 'Future<$resultClass>'; 226 futureClass = 'Future<$resultClass>';
227 } 227 }
228 writeln('$futureClass $methodName(${args.join(', ')}) {'); 228 writeln('$futureClass $methodName(${args.join(', ')}) async {');
229 indent(() { 229 indent(() {
230 String requestClass = camelJoin( 230 String requestClass = camelJoin(
231 [request.domainName, request.method, 'params'], 231 [request.domainName, request.method, 'params'],
232 doCapitalize: true); 232 doCapitalize: true);
233 String paramsVar = 'null'; 233 String paramsVar = 'null';
234 if (request.params != null) { 234 if (request.params != null) {
235 paramsVar = 'params'; 235 paramsVar = 'params';
236 List<String> args = <String>[]; 236 List<String> args = <String>[];
237 List<String> optionalArgs = <String>[]; 237 List<String> optionalArgs = <String>[];
238 for (TypeObjectField field in request.params.fields) { 238 for (TypeObjectField field in request.params.fields) {
239 if (field.optional) { 239 if (field.optional) {
240 optionalArgs.add('${field.name}: ${field.name}'); 240 optionalArgs.add('${field.name}: ${field.name}');
241 } else { 241 } else {
242 args.add(field.name); 242 args.add(field.name);
243 } 243 }
244 } 244 }
245 args.addAll(optionalArgs); 245 args.addAll(optionalArgs);
246 writeln('var params = new $requestClass(${args.join(', ')}).toJson();'); 246 writeln('var params = new $requestClass(${args.join(', ')}).toJson();');
247 } 247 }
248 writeln( 248 String methodJson = JSON.encode(request.longMethod);
249 'return server.send(${JSON.encode(request.longMethod)}, $paramsVar)'); 249 writeln('var result = await server.send($methodJson, $paramsVar);');
250 indent(() { 250 if (request.result != null) {
251 writeln(' .then((result) {'); 251 String kind = 'null';
252 if (request.result != null) { 252 if (requestClass == 'EditGetRefactoringParams') {
253 String kind = 'null'; 253 kind = 'kind';
254 if (requestClass == 'EditGetRefactoringParams') {
255 kind = 'kind';
256 }
257 writeln('ResponseDecoder decoder = new ResponseDecoder($kind);');
258 writeln(
259 "return new $resultClass.fromJson(decoder, 'result', result);");
260 } else {
261 writeln('expect(result, isNull);');
262 writeln('return null;');
263 } 254 }
264 }); 255 writeln('ResponseDecoder decoder = new ResponseDecoder($kind);');
265 writeln('});'); 256 writeln("return new $resultClass.fromJson(decoder, 'result', result);");
257 } else {
258 writeln('expect(result, isNull);');
259 writeln('return null;');
260 }
266 }); 261 });
267 writeln('}'); 262 writeln('}');
268 } 263 }
269 } 264 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/search/type_hierarchy_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698