(fromBlockId: string, toBlockId: string, variableName: string)
| 49 | }, {}) |
| 50 | |
| 51 | const createEdge = (fromBlockId: string, toBlockId: string, variableName: string) => { |
| 52 | const toNode = nodes[toBlockId] |
| 53 | if (!toNode) { |
| 54 | return |
| 55 | } |
| 56 | |
| 57 | if (!toNode.inputVariables.includes(variableName)) { |
| 58 | toNode.inputVariables.push(variableName) |
| 59 | } |
| 60 | |
| 61 | const fromNode = nodes[fromBlockId] |
| 62 | if (!fromNode) { |
| 63 | return |
| 64 | } |
| 65 | |
| 66 | if (!fromNode.outputVariables.includes(variableName)) { |
| 67 | fromNode.outputVariables.push(variableName) |
| 68 | } |
| 69 | |
| 70 | edges.push({ |
| 71 | from: fromBlockId, |
| 72 | to: toBlockId, |
| 73 | inputVariables: [variableName], |
| 74 | }) |
| 75 | } |
| 76 | |
| 77 | // We are not simply adding all edges based on usedVariables to definedVariables. |
| 78 | // We are taking block order into account - creating edges only with the closest defining block |
no outgoing calls
no test coverage detected