(e ast.NavigableExpr)
| 267 | } |
| 268 | |
| 269 | func maybeAsVariableName(e ast.NavigableExpr) (string, bool) { |
| 270 | if e.Kind() == ast.IdentKind { |
| 271 | return e.AsIdent(), true |
| 272 | } |
| 273 | if e.Kind() == ast.SelectKind { |
| 274 | sel := e.AsSelect() |
| 275 | // While the `ToQualifiedName` call could take the select directly, this |
| 276 | // would skip presence tests from possible matches, which we would like |
| 277 | // to include. |
| 278 | if qualName, found := containers.ToQualifiedName(sel.Operand()); found { |
| 279 | return qualName + "." + sel.FieldName(), true |
| 280 | } |
| 281 | } |
| 282 | return "", false |
| 283 | } |
no test coverage detected