Skip to content

Commit

Permalink
Elements. For LocalVariableFragment enclosingFragment can be anything…
Browse files Browse the repository at this point in the history
…, not only ExecutableFragment.

For example, here it is the top-level variable fragment.
```
final a = [for (final value in []) value * 2];
```

Change-Id: I0c09c890256b624a28c1d55fffbfd94f9431b83e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398928
Commit-Queue: Konstantin Shcheglov <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
  • Loading branch information
scheglov authored and Commit Queue committed Dec 4, 2024
1 parent fcd4d86 commit da3e12f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions pkg/analyzer/lib/dart/element/element2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1816,9 +1816,6 @@ abstract class LocalVariableFragment
@override
LocalVariableElement2 get element;

@override
ExecutableFragment? get enclosingFragment;

/// Whether the variable has an initializer at declaration.
bool get hasInitializer;

Expand Down
3 changes: 1 addition & 2 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7322,8 +7322,7 @@ class LocalVariableElementImpl extends NonParameterVariableElementImpl
LocalVariableElement2 get element => _element2;

@override
ExecutableFragment get enclosingFragment =>
enclosingElement3 as ExecutableFragment;
Fragment get enclosingFragment => enclosingElement3 as Fragment;

@override
String get identifier {
Expand Down

0 comments on commit da3e12f

Please sign in to comment.