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

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

Issue 2663063004: Don't resolve FieldFormalParameter field if not in constructor. (Closed)
Patch Set: Created 3 years, 10 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
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 analyzer.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 5886 matching lines...) Expand 10 before | Expand all | Expand 10 after
5897 if (element is ExecutableElement && !element.isStatic) { 5897 if (element is ExecutableElement && !element.isStatic) {
5898 return; 5898 return;
5899 } 5899 }
5900 _errorReporter.reportErrorForNode( 5900 _errorReporter.reportErrorForNode(
5901 StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, 5901 StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
5902 name, 5902 name,
5903 [enclosingElement.name]); 5903 [enclosingElement.name]);
5904 } 5904 }
5905 5905
5906 void _checkForValidField(FieldFormalParameter parameter) { 5906 void _checkForValidField(FieldFormalParameter parameter) {
5907 AstNode parent2 = parameter.parent?.parent;
5908 if (parent2 is! ConstructorDeclaration &&
5909 parent2?.parent is! ConstructorDeclaration) {
5910 return;
5911 }
5907 ParameterElement element = parameter.element; 5912 ParameterElement element = parameter.element;
5908 if (element is FieldFormalParameterElement) { 5913 if (element is FieldFormalParameterElement) {
5909 FieldElement fieldElement = element.field; 5914 FieldElement fieldElement = element.field;
5910 if (fieldElement == null || fieldElement.isSynthetic) { 5915 if (fieldElement == null || fieldElement.isSynthetic) {
5911 _errorReporter.reportErrorForNode( 5916 _errorReporter.reportErrorForNode(
5912 CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, 5917 CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD,
5913 parameter, 5918 parameter,
5914 [parameter.identifier.name]); 5919 [parameter.identifier.name]);
5915 } else { 5920 } else {
5916 ParameterElement parameterElement = parameter.element; 5921 ParameterElement parameterElement = parameter.element;
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
7073 class _InvocationCollector extends RecursiveAstVisitor { 7078 class _InvocationCollector extends RecursiveAstVisitor {
7074 final List<String> superCalls = <String>[]; 7079 final List<String> superCalls = <String>[];
7075 7080
7076 @override 7081 @override
7077 visitMethodInvocation(MethodInvocation node) { 7082 visitMethodInvocation(MethodInvocation node) {
7078 if (node.target is SuperExpression) { 7083 if (node.target is SuperExpression) {
7079 superCalls.add(node.methodName.name); 7084 superCalls.add(node.methodName.name);
7080 } 7085 }
7081 } 7086 }
7082 } 7087 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698