OLD | NEW |
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/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 _recordTypeArguments(node.offset, type.typeArguments); | 450 _recordTypeArguments(node.offset, type.typeArguments); |
451 } | 451 } |
452 } | 452 } |
453 } | 453 } |
454 | 454 |
455 @override | 455 @override |
456 visitMethodDeclaration(MethodDeclaration node) { | 456 visitMethodDeclaration(MethodDeclaration node) { |
457 super.visitMethodDeclaration(node); | 457 super.visitMethodDeclaration(node); |
458 if (node.element.enclosingElement is ClassElement && !node.isStatic) { | 458 if (node.element.enclosingElement is ClassElement && !node.isStatic) { |
459 if (node.returnType == null) { | 459 if (node.returnType == null) { |
460 // For now, we skip inferred return types of setters. | 460 _recordTopType(node.name.offset, node.element.returnType); |
461 // TODO(paulberry): fix this. | |
462 if (!node.isSetter) { | |
463 _recordTopType(node.name.offset, node.element.returnType); | |
464 } | |
465 } | 461 } |
466 if (node.parameters != null) { | 462 if (node.parameters != null) { |
467 for (var parameter in node.parameters.parameters) { | 463 for (var parameter in node.parameters.parameters) { |
468 // Note: it's tempting to check `parameter.type == null`, but that | 464 // Note: it's tempting to check `parameter.type == null`, but that |
469 // doesn't work because of function-typed formal parameter syntax. | 465 // doesn't work because of function-typed formal parameter syntax. |
470 if (parameter.element.hasImplicitType) { | 466 if (parameter.element.hasImplicitType) { |
471 _recordTopType(parameter.identifier.offset, parameter.element.type); | 467 _recordTopType(parameter.identifier.offset, parameter.element.type); |
472 } | 468 } |
473 } | 469 } |
474 } | 470 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 583 |
588 /// Based on DDC code generator's `_recoverTypeArguments` | 584 /// Based on DDC code generator's `_recoverTypeArguments` |
589 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { | 585 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { |
590 assert(identical(g.element, f.element)); | 586 assert(identical(g.element, f.element)); |
591 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); | 587 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); |
592 assert(g.typeFormals.length + g.typeArguments.length == | 588 assert(g.typeFormals.length + g.typeArguments.length == |
593 f.typeArguments.length); | 589 f.typeArguments.length); |
594 return f.typeArguments.skip(g.typeArguments.length); | 590 return f.typeArguments.skip(g.typeArguments.length); |
595 } | 591 } |
596 } | 592 } |
OLD | NEW |