Skip to content

Commit

Permalink
feat-fix: fixed dataflow generation for RFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasPietzschmann committed Sep 11, 2024
1 parent 7dcdbe6 commit b5517d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { resolveByName } from '../../../../environments/resolve-by-name'
import { VertexType } from '../../../../graph/vertex'


function mergeInformation(info: DataflowInformation | undefined, newInfo: DataflowInformation): DataflowInformation {
export function mergeInformation(info: DataflowInformation | undefined, newInfo: DataflowInformation): DataflowInformation {
if(info === undefined) {
return newInfo
}
Expand Down
27 changes: 9 additions & 18 deletions src/dataflow/internal/process/process-files.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import { type DataflowInformation, ExitPointType } from '../../info'
import { type DataflowInformation } from '../../info'
import type { DataflowProcessorInformation } from '../../processor'
import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate'
import { DataflowGraph } from '../../graph/graph'
import { VertexType } from '../../graph/vertex'
import { processDataflowFor } from '../../processor'
import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate'
import type { RFiles } from '../../../r-bridge/lang-4.x/ast/model/model'
import { mergeInformation } from './functions/call/named-call-handling'

export function processFiles<OtherInfo>(value: RNodeWithParent, data: DataflowProcessorInformation<OtherInfo>): DataflowInformation {
return {
unknownReferences: [],
in: [{ nodeId: value.info.id, name: undefined, controlDependencies: data.controlDependencies }],
out: [],
environment: data.environment,
graph: new DataflowGraph(data.completeAst.idMap).addVertex({
tag: VertexType.Value,
id: value.info.id,
controlDependencies: data.controlDependencies
}),
exitPoints: [{ nodeId: value.info.id, type: ExitPointType.Default, controlDependencies: data.controlDependencies }],
entryPoint: value.info.id
}
export function processFiles<OtherInfo>(value: RFiles<OtherInfo & ParentInformation>, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation {
return value.children
.map(file => processDataflowFor(file, data))
.reduce(mergeInformation)
}

0 comments on commit b5517d6

Please sign in to comment.