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 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 15704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15715 ExecutableElement outerFunction = _enclosingFunction; | 15715 ExecutableElement outerFunction = _enclosingFunction; |
15716 try { | 15716 try { |
15717 _enclosingFunction = node.element; | 15717 _enclosingFunction = node.element; |
15718 return super.visitMethodDeclaration(node); | 15718 return super.visitMethodDeclaration(node); |
15719 } finally { | 15719 } finally { |
15720 _enclosingFunction = outerFunction; | 15720 _enclosingFunction = outerFunction; |
15721 } | 15721 } |
15722 } | 15722 } |
15723 | 15723 |
15724 @override | 15724 @override |
| 15725 Object visitTypeName(TypeName node) { |
| 15726 return null; |
| 15727 } |
| 15728 |
| 15729 @override |
15725 Object visitSimpleIdentifier(SimpleIdentifier node) { | 15730 Object visitSimpleIdentifier(SimpleIdentifier node) { |
15726 // Ignore if already resolved - declaration or type. | 15731 // Ignore if already resolved - declaration or type. |
15727 if (node.staticElement != null) { | 15732 if (node.inDeclarationContext()) { |
| 15733 return null; |
| 15734 } |
| 15735 // Ignore if it cannot be a reference to a local variable. |
| 15736 AstNode parent = node.parent; |
| 15737 if (parent is FieldFormalParameter) { |
| 15738 return null; |
| 15739 } else if (parent is ConstructorDeclaration && parent.returnType == node) { |
| 15740 return null; |
| 15741 } else if (parent is ConstructorFieldInitializer && parent.fieldName == node
) { |
15728 return null; | 15742 return null; |
15729 } | 15743 } |
15730 // Ignore if qualified. | 15744 // Ignore if qualified. |
15731 AstNode parent = node.parent; | |
15732 if (parent is PrefixedIdentifier && identical(parent.identifier, node)) { | 15745 if (parent is PrefixedIdentifier && identical(parent.identifier, node)) { |
15733 return null; | 15746 return null; |
15734 } | 15747 } |
15735 if (parent is PropertyAccess && identical(parent.propertyName, node)) { | 15748 if (parent is PropertyAccess && identical(parent.propertyName, node)) { |
15736 return null; | 15749 return null; |
15737 } | 15750 } |
15738 if (parent is MethodInvocation && | 15751 if (parent is MethodInvocation && |
15739 identical(parent.methodName, node) && | 15752 identical(parent.methodName, node) && |
15740 parent.realTarget != null) { | 15753 parent.realTarget != null) { |
15741 return null; | 15754 return null; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15949 nonFields.add(node); | 15962 nonFields.add(node); |
15950 return null; | 15963 return null; |
15951 } | 15964 } |
15952 | 15965 |
15953 @override | 15966 @override |
15954 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); | 15967 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); |
15955 | 15968 |
15956 @override | 15969 @override |
15957 Object visitWithClause(WithClause node) => null; | 15970 Object visitWithClause(WithClause node) => null; |
15958 } | 15971 } |
OLD | NEW |