* Emit a `references` ref for every data item a statement WRITES (MOVE TO, * ADD TO/GIVING, SUBTRACT FROM/GIVING, COMPUTE =). Write-sites are what an * impact query on a working-storage or copybook field needs: "what changes * WS-TOTAL" is the COBOL analogue of value-reference edges. Read operand
( statement: SyntaxNode, fields: string[], fromNodeId: string | undefined, ctx: ExtractorContext )
| 278 | * impact value. |
| 279 | */ |
| 280 | function emitWriteRefs( |
| 281 | statement: SyntaxNode, |
| 282 | fields: string[], |
| 283 | fromNodeId: string | undefined, |
| 284 | ctx: ExtractorContext |
| 285 | ): void { |
| 286 | for (const field of fields) { |
| 287 | for (const target of statement.childrenForFieldName(field)) { |
| 288 | if (!target) continue; |
| 289 | const word = targetBaseName(target, ctx.source); |
| 290 | if (!word) continue; |
| 291 | const name = getNodeText(word, ctx.source).trim(); |
| 292 | if (!name || SPECIAL_REGISTER_RE.test(name)) continue; |
| 293 | addRef(ctx, fromNodeId, name, 'references', word); |
| 294 | } |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * Collect call/import references from a statement subtree, attributed to the |
no test coverage detected