computeQualifiers computes the qualified names parts of a select expression.
(e ast.Expr)
| 163 | |
| 164 | // computeQualifiers computes the qualified names parts of a select expression. |
| 165 | func (c *checker) computeQualifiers(e ast.Expr) ([]string, bool) { |
| 166 | var qualifiers []string |
| 167 | for e.Kind() == ast.SelectKind { |
| 168 | sel := e.AsSelect() |
| 169 | // test only expressions are not considered for qualified name selection. |
| 170 | if sel.IsTestOnly() { |
| 171 | return qualifiers, false |
| 172 | } |
| 173 | // otherwise append the select field name to the qualifier list (reverse order) |
| 174 | qualifiers = append(qualifiers, sel.FieldName()) |
| 175 | e = sel.Operand() |
| 176 | // If the next operand is an identifier, then append it, reverse the name sequence |
| 177 | // and return it to the caller.s |
| 178 | if e.Kind() == ast.IdentKind { |
| 179 | qualifiers = append(qualifiers, e.AsIdent()) |
| 180 | slices.Reverse(qualifiers) |
| 181 | return qualifiers, true |
| 182 | } |
| 183 | } |
| 184 | return qualifiers, false |
| 185 | } |
| 186 | |
| 187 | func (c *checker) checkOptSelect(e ast.Expr) { |
| 188 | // Collect metadata related to the opt select call packaged by the parser. |
no test coverage detected