Skip to content

Commit

Permalink
Merge pull request #286 from Workiva/greglittlefield-wf-patch-2
Browse files Browse the repository at this point in the history
FED-2610 Synchronize with over_react impl; pull in AbstractProps fix
  • Loading branch information
rmconsole6-wk authored Apr 26, 2024
2 parents 0c235dd + ead2cf2 commit 62f0f41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/src/util/get_all_props.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Taken from https://github.com/Workiva/over_react/blob/master/tools/analyzer_plugin/lib/src/util/prop_declarations/get_all_props.dart
// Taken from https://github.com/Workiva/over_react/blob/5c6e1742949ce4e739f7923b799cc00b1118279b/tools/analyzer_plugin/lib/src/util/prop_declarations/get_all_props.dart

// Copyright 2024 Workiva Inc.
//
Expand Down Expand Up @@ -70,7 +70,7 @@ List<FieldElement> getAllProps(InterfaceElement propsElement) {
final isMixinBasedPropsMixin = interface is MixinElement &&
interface.superclassConstraints.any((s) => s.element.name == 'UiProps');
late final isLegacyPropsOrPropsMixinConsumerClass = !isFromGeneratedFile &&
interface.metadata.any(_isPropsOrPropsMixinAnnotation);
interface.metadata.any(_isOneOfThePropsAnnotations);

if (!isMixinBasedPropsMixin && !isLegacyPropsOrPropsMixinConsumerClass) {
continue;
Expand All @@ -95,11 +95,12 @@ List<FieldElement> getAllProps(InterfaceElement propsElement) {
return allProps;
}

bool _isPropsOrPropsMixinAnnotation(ElementAnnotation e) {
bool _isOneOfThePropsAnnotations(ElementAnnotation e) {
// [2]
final element = e.element;
return element is ConstructorElement &&
const {'Props', 'PropsMixin'}.contains(element.enclosingElement.name);
const {'Props', 'PropsMixin', 'AbstractProps'}
.contains(element.enclosingElement.name);
}

bool _isPropsMixinAnnotation(ElementAnnotation e) {
Expand Down

0 comments on commit 62f0f41

Please sign in to comment.