mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:17:14 +00:00
[data driven fix] Add more information to matcher for property
accessors. Fixes https://github.com/dart-lang/sdk/issues/54730 Change-Id: Ia8bf540b157594a3400bb5c567b5a4c4886520ae Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350400 Commit-Queue: Keerti Parthasarathy <keertip@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
00be96e511
commit
df52948967
|
@ -6,7 +6,12 @@ import 'package:analysis_server/src/services/correction/fix/data_driven/element_
|
|||
import 'package:analysis_server/src/services/correction/fix/data_driven/element_kind.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart'
|
||||
show ExtensionElement, InterfaceElement, PrefixElement;
|
||||
show
|
||||
CompilationUnitElement,
|
||||
ExtensionElement,
|
||||
InterfaceElement,
|
||||
PrefixElement,
|
||||
PropertyAccessorElement;
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
|
||||
|
@ -528,6 +533,18 @@ class _MatcherBuilder {
|
|||
if (node.staticType is InvalidType) {
|
||||
_addMatcher(components: [node.name], kinds: [], node: node);
|
||||
} else {
|
||||
var staticElement = node.staticElement;
|
||||
// Add enclosing element to the matcher for non top level property
|
||||
// accessors when possible.
|
||||
if (staticElement is PropertyAccessorElement) {
|
||||
var enclosingElement = staticElement.enclosingElement;
|
||||
if (enclosingElement is! CompilationUnitElement) {
|
||||
_addMatcher(
|
||||
components: [node.name, enclosingElement.displayName],
|
||||
kinds: []);
|
||||
return;
|
||||
}
|
||||
}
|
||||
_addMatcher(components: [node.name], kinds: []);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class C {
|
|||
}
|
||||
}
|
||||
''');
|
||||
_assertMatcher('g;', expectedComponents: ['g']);
|
||||
_assertMatcher('g;', expectedComponents: ['g', 'C']);
|
||||
}
|
||||
|
||||
Future<void> test_getter_withoutTarget_unresolved() async {
|
||||
|
|
|
@ -1875,7 +1875,6 @@ void f(TextTheme theme) {
|
|||
''');
|
||||
}
|
||||
|
||||
@FailingTest(issue: 'https://github.com/Dart-Code/Dart-Code/issues/4857')
|
||||
Future<void> test_material_TextTheme_title_renamed() async {
|
||||
setPackageContent('''
|
||||
class Text() {
|
||||
|
|
Loading…
Reference in a new issue