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.element_resolver; | 5 library analyzer.src.generated.element_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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 !identical(element, enclosingClass)) { | 1093 !identical(element, enclosingClass)) { |
1094 _resolver.errorReporter.reportErrorForNode( | 1094 _resolver.errorReporter.reportErrorForNode( |
1095 CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node); | 1095 CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node); |
1096 element = null; | 1096 element = null; |
1097 } else if (element == null || | 1097 } else if (element == null || |
1098 (element is PrefixElement && !_isValidAsPrefix(node))) { | 1098 (element is PrefixElement && !_isValidAsPrefix(node))) { |
1099 // TODO(brianwilkerson) Recover from this error. | 1099 // TODO(brianwilkerson) Recover from this error. |
1100 if (_isConstructorReturnType(node)) { | 1100 if (_isConstructorReturnType(node)) { |
1101 _resolver.errorReporter.reportErrorForNode( | 1101 _resolver.errorReporter.reportErrorForNode( |
1102 CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node); | 1102 CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node); |
| 1103 } else if (parent is Annotation) { |
| 1104 _resolver.errorReporter.reportErrorForNode( |
| 1105 CompileTimeErrorCode.INVALID_ANNOTATION, parent); |
| 1106 } else if (element != null) { |
| 1107 _resolver.errorReporter.reportErrorForNode( |
| 1108 CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, |
| 1109 node, |
| 1110 [element.name]); |
| 1111 } else if (node.name == "await" && _resolver.enclosingFunction != null) { |
| 1112 _recordUndefinedNode( |
| 1113 _resolver.enclosingClass, |
| 1114 StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT, |
| 1115 node, |
| 1116 [_resolver.enclosingFunction.displayName]); |
1103 } else { | 1117 } else { |
1104 if (parent is Annotation) { | 1118 _recordUndefinedNode(_resolver.enclosingClass, |
1105 _resolver.errorReporter.reportErrorForNode( | 1119 StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.name]); |
1106 CompileTimeErrorCode.INVALID_ANNOTATION, parent); | |
1107 } else if (element != null) { | |
1108 _resolver.errorReporter.reportErrorForNode( | |
1109 CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, | |
1110 node, | |
1111 [element.name]); | |
1112 } else { | |
1113 if (node.name == "await" && _resolver.enclosingFunction != null) { | |
1114 _recordUndefinedNode(_resolver.enclosingClass, | |
1115 StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT, | |
1116 node, | |
1117 [_resolver.enclosingFunction.displayName]); | |
1118 } else { | |
1119 _recordUndefinedNode(_resolver.enclosingClass, | |
1120 StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.name]); | |
1121 } | |
1122 } | |
1123 } | 1120 } |
1124 } | 1121 } |
1125 node.staticElement = element; | 1122 node.staticElement = element; |
1126 if (node.inSetterContext() && | 1123 if (node.inSetterContext() && |
1127 node.inGetterContext() && | 1124 node.inGetterContext() && |
1128 enclosingClass != null) { | 1125 enclosingClass != null) { |
1129 InterfaceType enclosingType = enclosingClass.type; | 1126 InterfaceType enclosingType = enclosingClass.type; |
1130 AuxiliaryElements auxiliaryElements = new AuxiliaryElements( | 1127 AuxiliaryElements auxiliaryElements = new AuxiliaryElements( |
1131 _lookUpGetter(null, enclosingType, node.name), null); | 1128 _lookUpGetter(null, enclosingType, node.name), null); |
1132 node.auxiliaryElements = auxiliaryElements; | 1129 node.auxiliaryElements = auxiliaryElements; |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 | 2594 |
2598 @override | 2595 @override |
2599 Element get staticElement => null; | 2596 Element get staticElement => null; |
2600 | 2597 |
2601 @override | 2598 @override |
2602 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; | 2599 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; |
2603 | 2600 |
2604 @override | 2601 @override |
2605 void visitChildren(AstVisitor visitor) {} | 2602 void visitChildren(AstVisitor visitor) {} |
2606 } | 2603 } |
OLD | NEW |