OLD | NEW |
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 library analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
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/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 7176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7187 if (currentType == null || expectedType.isMoreSpecificThan(currentType)) { | 7187 if (currentType == null || expectedType.isMoreSpecificThan(currentType)) { |
7188 _overrideManager.setType(element, expectedType); | 7188 _overrideManager.setType(element, expectedType); |
7189 } | 7189 } |
7190 } | 7190 } |
7191 } | 7191 } |
7192 | 7192 |
7193 /** | 7193 /** |
7194 * Try to infer types of parameters of the [FunctionExpression] arguments. | 7194 * Try to infer types of parameters of the [FunctionExpression] arguments. |
7195 */ | 7195 */ |
7196 void _inferFunctionExpressionsParametersTypes(ArgumentList argumentList) { | 7196 void _inferFunctionExpressionsParametersTypes(ArgumentList argumentList) { |
7197 for (Expression argument in argumentList.arguments) { | 7197 NodeList<Expression> arguments = argumentList.arguments; |
| 7198 int length = arguments.length; |
| 7199 for (int i = 0; i < length; i++) { |
| 7200 Expression argument = arguments[i]; |
7198 ParameterElement parameter = argument.propagatedParameterElement; | 7201 ParameterElement parameter = argument.propagatedParameterElement; |
7199 if (parameter == null) { | 7202 if (parameter == null) { |
7200 parameter = argument.staticParameterElement; | 7203 parameter = argument.staticParameterElement; |
7201 } | 7204 } |
7202 if (parameter != null) { | 7205 if (parameter != null) { |
7203 _inferFunctionExpressionParametersTypes(argument, parameter.type); | 7206 _inferFunctionExpressionParametersTypes(argument, parameter.type); |
7204 } | 7207 } |
7205 } | 7208 } |
7206 } | 7209 } |
7207 | 7210 |
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9933 | 9936 |
9934 @override | 9937 @override |
9935 void visitClassMembersInScope(ClassDeclaration node) { | 9938 void visitClassMembersInScope(ClassDeclaration node) { |
9936 node.documentationComment?.accept(this); | 9939 node.documentationComment?.accept(this); |
9937 node.metadata.accept(this); | 9940 node.metadata.accept(this); |
9938 // | 9941 // |
9939 // Process field declarations before constructors and methods so that the | 9942 // Process field declarations before constructors and methods so that the |
9940 // types of field formal parameters can be correctly resolved. | 9943 // types of field formal parameters can be correctly resolved. |
9941 // | 9944 // |
9942 List<ClassMember> nonFields = new List<ClassMember>(); | 9945 List<ClassMember> nonFields = new List<ClassMember>(); |
9943 for (ClassMember member in node.members) { | 9946 NodeList<ClassMember> members = node.members; |
| 9947 int length = members.length; |
| 9948 for (int i = 0; i < length; i++) { |
| 9949 ClassMember member = members[i]; |
9944 if (member is ConstructorDeclaration) { | 9950 if (member is ConstructorDeclaration) { |
9945 nonFields.add(member); | 9951 nonFields.add(member); |
9946 } else { | 9952 } else { |
9947 member.accept(this); | 9953 member.accept(this); |
9948 } | 9954 } |
9949 } | 9955 } |
9950 int count = nonFields.length; | 9956 int count = nonFields.length; |
9951 for (int i = 0; i < count; i++) { | 9957 for (int i = 0; i < count; i++) { |
9952 nonFields[i].accept(this); | 9958 nonFields[i].accept(this); |
9953 } | 9959 } |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10981 return null; | 10987 return null; |
10982 } | 10988 } |
10983 if (identical(node.staticElement, variable)) { | 10989 if (identical(node.staticElement, variable)) { |
10984 if (node.inSetterContext()) { | 10990 if (node.inSetterContext()) { |
10985 result = true; | 10991 result = true; |
10986 } | 10992 } |
10987 } | 10993 } |
10988 return null; | 10994 return null; |
10989 } | 10995 } |
10990 } | 10996 } |
OLD | NEW |