GetExplanationOutputPolicy returns a copy of the policy, except the output of each match block is replaced by the expression in the explanation field.
()
| 152 | // GetExplanationOutputPolicy returns a copy of the policy, except the output of each match block |
| 153 | // is replaced by the expression in the explanation field. |
| 154 | func (p *Policy) GetExplanationOutputPolicy() *Policy { |
| 155 | ep := Policy{ |
| 156 | name: p.name, |
| 157 | semantic: p.semantic, |
| 158 | info: p.info, |
| 159 | metadata: p.metadata, |
| 160 | source: p.source, |
| 161 | } |
| 162 | if p.rule != nil { |
| 163 | ep.rule = p.rule.getExplanationOutputRule() |
| 164 | } |
| 165 | return &ep |
| 166 | } |
| 167 | |
| 168 | // NewImport creates a new typename import node |
| 169 | func NewImport(exprID int64) *Import { |