Skip to content

Commit

Permalink
Fix code scanning alert (#2738)
Browse files Browse the repository at this point in the history
  • Loading branch information
gayathrir11 authored Oct 25, 2023
1 parent 6931173 commit baaf0a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .changeset/curvy-dancers-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
'@finos/legend-query-builder': patch
---
Original file line number Diff line number Diff line change
Expand Up @@ -363,40 +363,28 @@ export const buildPropertyExpressionFromExistsNode = (
node: QueryBuilderFilterTreeConditionNodeData,
): AbstractPropertyExpression => {
let nodeParent = filterState.getParentNode(node);
let existsLambdaParameterNames: string[] = [];
let existsLambdaExpressions: AbstractPropertyExpression[] = [];
existsLambdaExpressions.push(
node.condition.propertyExpressionState.propertyExpression,
);
existsLambdaParameterNames.push(
nodeParent?.lambdaParameterName ?? filterState.lambdaParameterName,
);
while (nodeParent && nodeParent.id !== existsNode.id) {
if (nodeParent instanceof QueryBuilderFilterTreeExistsNodeData) {
existsLambdaExpressions.push(
nodeParent.propertyExpressionState.propertyExpression,
);
existsLambdaParameterNames.push(
nodeParent.lambdaParameterName ?? filterState.lambdaParameterName,
);
}
nodeParent = filterState.getParentNode(nodeParent);
}
if (nodeParent?.id === existsNode.id) {
existsLambdaExpressions.push(
existsNode.propertyExpressionState.propertyExpression,
);
existsLambdaParameterNames.push(
existsNode.lambdaParameterName ?? filterState.lambdaParameterName,
);
}
existsLambdaParameterNames = existsLambdaParameterNames.reverse();
existsLambdaExpressions = existsLambdaExpressions.reverse();

const initialPropertyExpression = guaranteeNonNullable(
existsLambdaExpressions[0],
);
existsLambdaParameterNames = existsLambdaParameterNames.slice(1);
existsLambdaExpressions = existsLambdaExpressions.slice(1);

let flattenedPropertyExpressionChain = new AbstractPropertyExpression('');
Expand Down

0 comments on commit baaf0a3

Please sign in to comment.