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.element_resolver; | 5 library engine.resolver.element_resolver; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'ast.dart'; | 9 import 'ast.dart'; |
10 import 'element.dart'; | 10 import 'element.dart'; |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 | 967 |
968 @override | 968 @override |
969 Object visitSimpleIdentifier(SimpleIdentifier node) { | 969 Object visitSimpleIdentifier(SimpleIdentifier node) { |
970 // | 970 // |
971 // Synthetic identifiers have been already reported during parsing. | 971 // Synthetic identifiers have been already reported during parsing. |
972 // | 972 // |
973 if (node.isSynthetic) { | 973 if (node.isSynthetic) { |
974 return null; | 974 return null; |
975 } | 975 } |
976 // | 976 // |
977 // We ignore identifiers that have already been resolved, such as | 977 // Ignore nodes that should have been resolved before getting here. |
978 // identifiers representing the name in a declaration. | |
979 // | 978 // |
980 if (node.staticElement != null) { | 979 if (node.inDeclarationContext()) { |
| 980 return null; |
| 981 } |
| 982 AstNode parent = node.parent; |
| 983 if (parent is FieldFormalParameter) { |
| 984 return null; |
| 985 } else if (parent is ConstructorFieldInitializer && |
| 986 parent.fieldName == node) { |
| 987 return null; |
| 988 } else if (parent is Annotation && parent.constructorName == node) { |
981 return null; | 989 return null; |
982 } | 990 } |
983 // | 991 // |
984 // The name dynamic denotes a Type object even though dynamic is not a | 992 // The name dynamic denotes a Type object even though dynamic is not a |
985 // class. | 993 // class. |
986 // | 994 // |
987 if (node.name == _dynamicType.name) { | 995 if (node.name == _dynamicType.name) { |
988 node.staticElement = _dynamicType.element; | 996 node.staticElement = _dynamicType.element; |
989 node.staticType = _typeType; | 997 node.staticType = _typeType; |
990 return null; | 998 return null; |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 | 2823 |
2816 @override | 2824 @override |
2817 Element get staticElement => null; | 2825 Element get staticElement => null; |
2818 | 2826 |
2819 @override | 2827 @override |
2820 accept(AstVisitor visitor) => null; | 2828 accept(AstVisitor visitor) => null; |
2821 | 2829 |
2822 @override | 2830 @override |
2823 void visitChildren(AstVisitor visitor) {} | 2831 void visitChildren(AstVisitor visitor) {} |
2824 } | 2832 } |
OLD | NEW |