Skip to content

Commit

Permalink
Add _PropertyElement.toString.
Browse files Browse the repository at this point in the history
This improves the debug experience when debugging flow analysis code.

Change-Id: I876dece6213b0495caae5a9e673376898198e709
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389221
Commit-Queue: Paul Berry <[email protected]>
Reviewed-by: Kallen Tu <[email protected]>
  • Loading branch information
stereotype441 authored and Commit Queue committed Oct 10, 2024
1 parent 867391e commit e8ff9ef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/_fe_analyzer_shared/test/mini_ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ class Harness {

late final Map<String, _PropertyElement?> _members = {
for (var entry in _coreMemberTypes.entries)
entry.key: _PropertyElement(entry.value,
entry.key: _PropertyElement(entry.value, entry.key.split('.').last,
isPromotable: false, whyNotPromotable: null)
};

Expand Down Expand Up @@ -1769,7 +1769,7 @@ class Harness {
_members[query] = null;
return;
}
_members[query] = _PropertyElement(Type(type),
_members[query] = _PropertyElement(Type(type), memberName,
isPromotable: promotable, whyNotPromotable: whyNotPromotable);
}

Expand Down Expand Up @@ -6209,6 +6209,12 @@ class _PropertyElement {
/// The type of the property.
final Type _type;

/// The name of the property (used by toString)
final String _name;

@override
String toString() => '$_type.$_name';

/// Whether the property is promotable.
final bool isPromotable;

Expand All @@ -6223,7 +6229,7 @@ class _PropertyElement {
/// to the test.
final PropertyNonPromotabilityReason? whyNotPromotable;

_PropertyElement(this._type,
_PropertyElement(this._type, this._name,
{required this.isPromotable, required this.whyNotPromotable}) {
if (isPromotable) {
assert(whyNotPromotable == null);
Expand Down

0 comments on commit e8ff9ef

Please sign in to comment.