| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.task.strong_mode; | 5 library analyzer.src.task.strong_mode; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (setter is PropertyAccessorElement && setter.isSetter) { | 47 if (setter is PropertyAccessorElement && setter.isSetter) { |
| 48 List<ParameterElement> parameters = setter.parameters; | 48 List<ParameterElement> parameters = setter.parameters; |
| 49 if (parameters.length == 1) { | 49 if (parameters.length == 1) { |
| 50 return parameters[0]; | 50 return parameters[0]; |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 return null; | 53 return null; |
| 54 } | 54 } |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * A function that returns `true` if the given [variable] passes the filter. | 57 * A function that returns `true` if the given [element] passes the filter. |
| 58 */ | 58 */ |
| 59 typedef bool VariableFilter(VariableElement element); | 59 typedef bool VariableFilter(VariableElement element); |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * An object used to infer the type of instance fields and the return types of | 62 * An object used to infer the type of instance fields and the return types of |
| 63 * instance methods within a single compilation unit. | 63 * instance methods within a single compilation unit. |
| 64 */ | 64 */ |
| 65 class InstanceMemberInferrer { | 65 class InstanceMemberInferrer { |
| 66 /** | 66 /** |
| 67 * The type provider used to look up types. | 67 * The type provider used to look up types. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (returnType == null) { | 158 if (returnType == null) { |
| 159 returnType = type; | 159 returnType = type; |
| 160 } else if (returnType != type) { | 160 } else if (returnType != type) { |
| 161 return typeProvider.dynamicType; | 161 return typeProvider.dynamicType; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 return returnType ?? typeProvider.dynamicType; | 164 return returnType ?? typeProvider.dynamicType; |
| 165 } | 165 } |
| 166 | 166 |
| 167 /** | 167 /** |
| 168 * Given a [method], return the type of the parameter in the method that | 168 * Given a method, return the type of the parameter in the method that |
| 169 * corresponds to the given [parameter]. If the parameter is positional, then | 169 * corresponds to the given [parameter]. If the parameter is positional, then |
| 170 * it appears at the given [index] in its enclosing element's list of | 170 * it appears at the given [index] in its enclosing element's list of |
| 171 * parameters. | 171 * parameters. |
| 172 */ | 172 */ |
| 173 DartType _getTypeOfCorrespondingParameter(ParameterElement parameter, | 173 DartType _getTypeOfCorrespondingParameter(ParameterElement parameter, |
| 174 int index, List<ParameterElement> methodParameters) { | 174 int index, List<ParameterElement> methodParameters) { |
| 175 // | 175 // |
| 176 // Find the corresponding parameter. | 176 // Find the corresponding parameter. |
| 177 // | 177 // |
| 178 ParameterElement matchingParameter = null; | 178 ParameterElement matchingParameter = null; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 results.add(element); | 480 results.add(element); |
| 481 } | 481 } |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 /** | 486 /** |
| 487 * A class of exception that is not used anywhere else. | 487 * A class of exception that is not used anywhere else. |
| 488 */ | 488 */ |
| 489 class _CycleException implements Exception {} | 489 class _CycleException implements Exception {} |
| OLD | NEW |