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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1397193002: Access types safely in TypeResolverVisior.visitMethodDeclaration() (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/analyzer/test/generated/non_error_resolver_test.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) 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 engine.resolver; 5 library engine.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'ast.dart'; 9 import 'ast.dart';
10 import 'constant.dart'; 10 import 'constant.dart';
(...skipping 14404 matching lines...) Expand 10 before | Expand all | Expand 10 after
14415 element.getAncestor((element) => element is ClassElement); 14415 element.getAncestor((element) => element is ClassElement);
14416 if (definingClass != null) { 14416 if (definingClass != null) {
14417 type.typeArguments = definingClass.type.typeArguments; 14417 type.typeArguments = definingClass.type.typeArguments;
14418 } 14418 }
14419 element.type = type; 14419 element.type = type;
14420 if (element is PropertyAccessorElement) { 14420 if (element is PropertyAccessorElement) {
14421 PropertyAccessorElement accessor = element as PropertyAccessorElement; 14421 PropertyAccessorElement accessor = element as PropertyAccessorElement;
14422 PropertyInducingElementImpl variable = 14422 PropertyInducingElementImpl variable =
14423 accessor.variable as PropertyInducingElementImpl; 14423 accessor.variable as PropertyInducingElementImpl;
14424 if (accessor.isGetter) { 14424 if (accessor.isGetter) {
14425 variable.type = type.returnType; 14425 variable.type = type.baseReturnType;
14426 } else if (variable.type == null) { 14426 } else if (variable.type == null) {
14427 List<DartType> parameterTypes = type.normalParameterTypes; 14427 List<ParameterElement> parameters = type.baseParameters;
14428 if (parameterTypes != null && parameterTypes.length > 0) { 14428 if (parameters != null && parameters.length > 0) {
14429 variable.type = parameterTypes[0]; 14429 variable.type = parameters[0].type;
14430 } 14430 }
14431 } 14431 }
14432 } 14432 }
14433 return null; 14433 return null;
14434 } 14434 }
14435 14435
14436 @override 14436 @override
14437 Object visitSimpleFormalParameter(SimpleFormalParameter node) { 14437 Object visitSimpleFormalParameter(SimpleFormalParameter node) {
14438 super.visitSimpleFormalParameter(node); 14438 super.visitSimpleFormalParameter(node);
14439 DartType declaredType; 14439 DartType declaredType;
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
15949 nonFields.add(node); 15949 nonFields.add(node);
15950 return null; 15950 return null;
15951 } 15951 }
15952 15952
15953 @override 15953 @override
15954 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 15954 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
15955 15955
15956 @override 15956 @override
15957 Object visitWithClause(WithClause node) => null; 15957 Object visitWithClause(WithClause node) => null;
15958 } 15958 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698