Skip to content

Commit

Permalink
feat-fix: more guards, more better
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasPietzschmann committed Aug 30, 2024
1 parent 0123734 commit 89fded3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cli/repl/commands/lineage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { edgeIncludesType, EdgeType } from '../../../dataflow/graph/edge'
import type { DataflowGraphVertexInfo } from '../../../dataflow/graph/vertex'

Check failure on line 12 in src/cli/repl/commands/lineage.ts

View workflow job for this annotation

GitHub Actions / 👩‍🏫 Linting (local)

'DataflowGraphVertexInfo' is defined but never used. Allowed unused vars must match /^_/u
import type { DataflowInformation } from '../../../dataflow/info'
import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate'
import { guard } from '../../../util/assert'

function splitAt(str: string, idx: number) {
return [str.slice(0, idx), str.slice(idx)]
Expand Down Expand Up @@ -42,7 +43,9 @@ function pushRelevantEdges(queue: [NodeId, DataflowGraphEdge][], outgoingEdges:
* @returns The lineage of the node represented as a list of node ids
*/
export function getLineage(criterion: SingleSlicingCriterion, ast: NormalizedAst, dfg: DataflowInformation) {
const [vertex, outgoingEdges] = dfg.graph.get(slicingCriterionToId(criterion, ast)) as [DataflowGraphVertexInfo, OutgoingEdges]
const src = dfg.graph.get(slicingCriterionToId(criterion, ast))
guard(src !== undefined, 'The ID pointed to by the criterion does not exist in the dataflow graph')
const [vertex, outgoingEdges] = src
const result: Set<NodeId> = new Set([vertex.id])
const edgeQueue = pushRelevantEdges([], outgoingEdges)

Expand Down

0 comments on commit 89fded3

Please sign in to comment.