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

Side by Side Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart

Issue 2921533004: Annotate optional parameter inferred types in front end test cases. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart » ('j') | 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 visitFunctionExpression(FunctionExpression node) { 312 visitFunctionExpression(FunctionExpression node) {
313 super.visitFunctionExpression(node); 313 super.visitFunctionExpression(node);
314 if (node.parent is! FunctionDeclaration) { 314 if (node.parent is! FunctionDeclaration) {
315 DartType type = node.staticType; 315 DartType type = node.staticType;
316 if (type is FunctionType) { 316 if (type is FunctionType) {
317 _instrumentation.record(uri, node.offset, 'returnType', 317 _instrumentation.record(uri, node.offset, 'returnType',
318 new _InstrumentationValueForType(type.returnType, elementNamer)); 318 new _InstrumentationValueForType(type.returnType, elementNamer));
319 List<FormalParameter> parameters = node.parameters.parameters; 319 List<FormalParameter> parameters = node.parameters.parameters;
320 for (int i = 0; i < parameters.length; i++) { 320 for (int i = 0; i < parameters.length; i++) {
321 FormalParameter parameter = parameters[i]; 321 FormalParameter parameter = parameters[i];
322 if (parameter is SimpleFormalParameter && parameter.type == null) { 322 NormalFormalParameter normalParameter =
323 parameter is DefaultFormalParameter
324 ? parameter.parameter
325 : parameter;
326 if (normalParameter is SimpleFormalParameter &&
327 normalParameter.type == null) {
323 _recordType(parameter.offset, type.parameters[i].type); 328 _recordType(parameter.offset, type.parameters[i].type);
324 } 329 }
325 } 330 }
326 } 331 }
327 } 332 }
328 } 333 }
329 334
330 @override 335 @override
331 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { 336 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
332 super.visitFunctionExpressionInvocation(node); 337 super.visitFunctionExpressionInvocation(node);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 498
494 /// Based on DDC code generator's `_recoverTypeArguments` 499 /// Based on DDC code generator's `_recoverTypeArguments`
495 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { 500 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) {
496 assert(identical(g.element, f.element)); 501 assert(identical(g.element, f.element));
497 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); 502 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty);
498 assert(g.typeFormals.length + g.typeArguments.length == 503 assert(g.typeFormals.length + g.typeArguments.length ==
499 f.typeArguments.length); 504 f.typeArguments.length);
500 return f.typeArguments.skip(g.typeArguments.length); 505 return f.typeArguments.skip(g.typeArguments.length);
501 } 506 }
502 } 507 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/testcases/inference/downwards_inference_initializing_formal_default_formal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698