backpropAcrossSend handles backpropagation for send statements. It is designed to be called from backpropAcrossNode as a special handler.
(rootNode *RootAssertionNode, node *ast.SendStmt)
| 120 | // backpropAcrossSend handles backpropagation for send statements. It is designed to be called from |
| 121 | // backpropAcrossNode as a special handler. |
| 122 | func backpropAcrossSend(rootNode *RootAssertionNode, node *ast.SendStmt) error { |
| 123 | // Note that for channel sends, we have: |
| 124 | // (1) A send to a nil channel blocks forever; |
| 125 | // (2) A send to a closed channel panics. |
| 126 | // (1) falls out of scope for NilAway and hence we do not create a consumer here for the |
| 127 | // channel variable. For (2), since we do not track the state of the channels, we currently |
| 128 | // cannot support it. |
| 129 | // TODO: rethink our strategy of handling channels (#192). |
| 130 | consumer, err := exprAsAssignmentConsumer(rootNode, node, nil) |
| 131 | if err != nil { |
| 132 | return err |
| 133 | } |
| 134 | if consumer != nil { |
| 135 | rootNode.AddConsumption(&annotation.ConsumeTrigger{ |
| 136 | Annotation: consumer, |
| 137 | Expr: node.Value, |
| 138 | Guards: guard.NoGuards(), |
| 139 | }) |
| 140 | } |
| 141 | |
| 142 | rootNode.AddComputation(node.Chan) |
| 143 | rootNode.AddComputation(node.Value) |
| 144 | |
| 145 | return nil |
| 146 | } |
| 147 | |
| 148 | // backpropAcrossReturn handles backpropagation for return statements. It is designed to be called |
| 149 | // from backpropAcrossNode as a special handler. |
no test coverage detected