firstThisPathComponent returns the first component common to every dag.This.Path in e and a Boolean indicating whether such a common first component exists.
(e dag.Expr)
| 160 | // firstThisPathComponent returns the first component common to every dag.This.Path |
| 161 | // in e and a Boolean indicating whether such a common first component exists. |
| 162 | func firstThisPathComponent(e dag.Expr) (prefix string, ok bool) { |
| 163 | walkT(reflect.ValueOf(e), func(t dag.ThisExpr) dag.ThisExpr { |
| 164 | if prefix == "" { |
| 165 | prefix = t.Path[0] |
| 166 | ok = true |
| 167 | } else if prefix != t.Path[0] { |
| 168 | ok = false |
| 169 | } |
| 170 | return t |
| 171 | }) |
| 172 | return prefix, ok |
| 173 | } |
| 174 | |
| 175 | // stripFirstThisPathComponent removes the first component of every dag.This.Path in e. |
| 176 | func stripFirstThisPathComponent(e dag.Expr) { |
no test coverage detected