Skip to content

Commit

Permalink
Improve clarification
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronlademann-wf committed Apr 10, 2024
1 parent fa55d06 commit f529715
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ class FnPropNullAwareCallSuggestor extends RecursiveAstVisitor
/// after the null condition is checked.
ExpressionStatement? _getPropFunctionExpressionBeingCalledConditionally(
BinaryExpression condition) {
// if (props.fn != null) { ... }
if (condition.parent is IfStatement) {
//
// Handles conditions of the form:
// if (props.fn != null) { ... }
//

var propFunctionBeingNullChecked =
_getPropFunctionBeingNullChecked(condition);

Expand All @@ -121,9 +125,12 @@ class FnPropNullAwareCallSuggestor extends RecursiveAstVisitor
propFunctionBeingNullChecked?.staticElement?.declaration;
return matches;
}) as ExpressionStatement?;
// props.fn != null && ...
} else if (condition.parent is ExpressionStatement &&
condition.leftOperand is BinaryExpression) {
//
// Handles conditions of the form:
// props.fn != null && ...
//
final propFunctionBeingNullChecked = _getPropFunctionBeingNullChecked(
condition.leftOperand as BinaryExpression);
if (propFunctionBeingNullChecked == null) return null;
Expand Down

0 comments on commit f529715

Please sign in to comment.