backpropAcrossBlock iterates over all nodes in the CFG block in _reverse_ order, writes logs, and delegates the handling of each node to backpropAcrossNode.
(rootNode *RootAssertionNode, block *cfg.Block)
| 38 | // backpropAcrossBlock iterates over all nodes in the CFG block in _reverse_ order, writes logs, |
| 39 | // and delegates the handling of each node to backpropAcrossNode. |
| 40 | func backpropAcrossBlock(rootNode *RootAssertionNode, block *cfg.Block) error { |
| 41 | // Iterate over all blocks in _reverse_ order |
| 42 | for i := len(block.Nodes) - 1; i >= 0; i-- { |
| 43 | node := block.Nodes[i] |
| 44 | |
| 45 | err := backpropAcrossNode(rootNode, node) |
| 46 | if err != nil { |
| 47 | pos := rootNode.Pass().Fset.Position(node.Pos()) |
| 48 | // If any error occurs when back-propagating a node, we wrap the error with more |
| 49 | // information such as file name and positions for easier debugging. |
| 50 | return fmt.Errorf( |
| 51 | "backpropagation across node (%s:%d:%d) of type %T failed for reason: %w", |
| 52 | pos.Filename, pos.Line, pos.Column, node, err, |
| 53 | ) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | return nil |
| 58 | } |
| 59 | |
| 60 | // backpropAcrossNode is the main driver function for the backpropagation of each node of |
| 61 | // different types. For some complicated cases, it further delegates the handling to other |
no test coverage detected