Skip to content

Commit

Permalink
refactor(query): use idMap from ast to avoid null check - #1107
Browse files Browse the repository at this point in the history
  • Loading branch information
gigalasr committed Jan 30, 2025
1 parent e7de1c4 commit 4295bac
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ export function fingerPrintOfQuery(query: ResolveValueQuery): string {
return JSON.stringify(query);
}

export function executeResolveValueQuery({ dataflow: { graph, environment } }: BasicQueryData, queries: readonly ResolveValueQuery[]): ResolveValueQueryResult {
const idMap = graph.idMap;

if(!idMap) {
throw new Error('idMap was undefined');
}

export function executeResolveValueQuery({ dataflow: { graph, environment }, ast }: BasicQueryData, queries: readonly ResolveValueQuery[]): ResolveValueQueryResult {
const start = Date.now();
const results: ResolveValueQueryResult['results'] = {};
for(const query of queries) {
Expand All @@ -26,7 +20,7 @@ export function executeResolveValueQuery({ dataflow: { graph, environment } }: B
}

const values = query.criteria
.map(criteria => recoverName(slicingCriterionToId(criteria, idMap), idMap))
.map(criteria => recoverName(slicingCriterionToId(criteria, ast.idMap), ast.idMap))
.flatMap(ident => resolveToValues(ident, environment, graph));

results[key] = {
Expand Down

0 comments on commit 4295bac

Please sign in to comment.