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

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

Issue 2403503002: Do not report unresolved names as comflicting with the SDK (issue 27544) (Closed)
Patch Set: Created 4 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 | no next file » | 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 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 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 String name = element.displayName; 2348 String name = element.displayName;
2349 List<Element> conflictingMembers = element.conflictingElements; 2349 List<Element> conflictingMembers = element.conflictingElements;
2350 int count = conflictingMembers.length; 2350 int count = conflictingMembers.length;
2351 List<String> libraryNames = new List<String>(count); 2351 List<String> libraryNames = new List<String>(count);
2352 for (int i = 0; i < count; i++) { 2352 for (int i = 0; i < count; i++) {
2353 libraryNames[i] = _getLibraryName(conflictingMembers[i]); 2353 libraryNames[i] = _getLibraryName(conflictingMembers[i]);
2354 } 2354 }
2355 libraryNames.sort(); 2355 libraryNames.sort();
2356 _errorReporter.reportErrorForNode(StaticWarningCode.AMBIGUOUS_IMPORT, 2356 _errorReporter.reportErrorForNode(StaticWarningCode.AMBIGUOUS_IMPORT,
2357 node, [name, StringUtilities.printListOfQuotedNames(libraryNames)]); 2357 node, [name, StringUtilities.printListOfQuotedNames(libraryNames)]);
2358 } else { 2358 } else if (element != null) {
2359 List<Element> sdkElements = 2359 List<Element> sdkElements =
2360 node.getProperty(LibraryImportScope.conflictingSdkElements); 2360 node.getProperty(LibraryImportScope.conflictingSdkElements);
2361 if (sdkElements != null) { 2361 if (sdkElements != null) {
2362 _errorReporter.reportErrorForNode( 2362 _errorReporter.reportErrorForNode(
2363 StaticWarningCode.CONFLICTING_DART_IMPORT, node, [ 2363 StaticWarningCode.CONFLICTING_DART_IMPORT, node, [
2364 element.displayName, 2364 element.displayName,
2365 _getLibraryName(sdkElements[0]), 2365 _getLibraryName(sdkElements[0]),
2366 _getLibraryName(element) 2366 _getLibraryName(element)
2367 ]); 2367 ]);
2368 } 2368 }
(...skipping 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after
6365 return null; 6365 return null;
6366 } 6366 }
6367 ClassElement classElement = 6367 ClassElement classElement =
6368 member.getAncestor((element) => element is ClassElement); 6368 member.getAncestor((element) => element is ClassElement);
6369 if (classElement == null) { 6369 if (classElement == null) {
6370 return null; 6370 return null;
6371 } 6371 }
6372 String name = member.name; 6372 String name = member.name;
6373 ClassElement superclass = classElement.supertype?.element; 6373 ClassElement superclass = classElement.supertype?.element;
6374 while (superclass != null) { 6374 while (superclass != null) {
6375 ExecutableElement member = superclass.getMethod(name) ?? superclass.getGet ter(name) ?? superclass.getSetter(name); 6375 ExecutableElement member = superclass.getMethod(name) ??
6376 superclass.getGetter(name) ??
6377 superclass.getSetter(name);
6376 if (member != null) { 6378 if (member != null) {
6377 return member; 6379 return member;
6378 } 6380 }
6379 superclass = superclass.supertype?.element; 6381 superclass = superclass.supertype?.element;
6380 } 6382 }
6381 return null; 6383 return null;
6382 } 6384 }
6383 6385
6384 /** 6386 /**
6385 * Return the type of the first and only parameter of the given [setter]. 6387 * Return the type of the first and only parameter of the given [setter].
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
6895 class _InvocationCollector extends RecursiveAstVisitor { 6897 class _InvocationCollector extends RecursiveAstVisitor {
6896 final List<String> superCalls = <String>[]; 6898 final List<String> superCalls = <String>[];
6897 6899
6898 @override 6900 @override
6899 visitMethodInvocation(MethodInvocation node) { 6901 visitMethodInvocation(MethodInvocation node) {
6900 if (node.target is SuperExpression) { 6902 if (node.target is SuperExpression) {
6901 superCalls.add(node.methodName.name); 6903 superCalls.add(node.methodName.name);
6902 } 6904 }
6903 } 6905 }
6904 } 6906 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698