Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FED-2610 Synchronize with over_react impl; pull in AbstractProps fix #286

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading