Skip to content

Commit

Permalink
Elements. Migrate ElementDescriptor.
Browse files Browse the repository at this point in the history
Change-Id: I7b5d42c4302835ec35a5ab1e607e7b4b836e5a3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387461
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
  • Loading branch information
scheglov authored and Commit Queue committed Sep 30, 2024
1 parent b8ab686 commit 1488e4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions pkg/analysis_server/analyzer_use_new_elements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,4 @@ lib/src/utilities/tee_string_sink.dart
lib/src/utilities/usage_tracking/usage_tracking.dart
lib/src/utilities/yaml_node_locator.dart
lib/starter.dart
lib/src/services/correction/fix/data_driven/element_descriptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'package:analysis_server/src/services/correction/fix/data_driven/element_kind.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart' show InterfaceElement;
import 'package:analyzer/dart/element/element2.dart';
import 'package:analyzer/dart/element/type.dart';

/// A description of an element.
Expand Down Expand Up @@ -139,9 +139,9 @@ class ElementDescriptor {
} else {
var type = target.staticType;
if (type == null && target is SimpleIdentifier) {
var element = target.staticElement;
var element = target.element;
// TODO(brianwilkerson): Handle more than `InterfaceElement`.
if (element is InterfaceElement) {
if (element is InterfaceElement2) {
type = element.thisType;
}
}
Expand All @@ -151,11 +151,11 @@ class ElementDescriptor {
return true;
}
if (type is InterfaceType) {
if (components[1] == type.element.name) {
if (components[1] == type.element3.name) {
return true;
}
for (var supertype in type.allSupertypes) {
if (components[1] == supertype.element.name) {
if (components[1] == supertype.element3.name) {
return true;
}
}
Expand Down

0 comments on commit 1488e4d

Please sign in to comment.