handleGetIndexInfosOfType returns the index infos of a type.
(ctx context.Context, params *CheckerTypeParams)
| 2388 | |
| 2389 | // handleGetIndexInfosOfType returns the index infos of a type. |
| 2390 | func (s *Session) handleGetIndexInfosOfType(ctx context.Context, params *CheckerTypeParams) ([]*IndexInfoResponse, error) { |
| 2391 | setup, err := s.setupChecker(ctx, params.Snapshot, params.Project) |
| 2392 | if err != nil { |
| 2393 | return nil, err |
| 2394 | } |
| 2395 | defer setup.done() |
| 2396 | |
| 2397 | t, err := setup.resolveTypeHandle(params.Type) |
| 2398 | if err != nil { |
| 2399 | return nil, err |
| 2400 | } |
| 2401 | |
| 2402 | infos := setup.checker.GetIndexInfosOfType(t) |
| 2403 | if len(infos) == 0 { |
| 2404 | return nil, nil |
| 2405 | } |
| 2406 | |
| 2407 | results := make([]*IndexInfoResponse, len(infos)) |
| 2408 | for i, info := range infos { |
| 2409 | results[i] = &IndexInfoResponse{ |
| 2410 | KeyType: *setup.newTypeResponse(info.KeyType()), |
| 2411 | ValueType: *setup.newTypeResponse(info.ValueType()), |
| 2412 | IsReadonly: info.IsReadonly(), |
| 2413 | } |
| 2414 | if info.Declaration() != nil { |
| 2415 | results[i].Declaration = setup.sd.nodeHandleFrom(info.Declaration()) |
| 2416 | } |
| 2417 | } |
| 2418 | |
| 2419 | return results, nil |
| 2420 | } |
| 2421 | |
| 2422 | // handleGetConstraintOfTypeParameter returns the constraint of a type parameter. |
| 2423 | func (s *Session) handleGetConstraintOfTypeParameter(ctx context.Context, params *CheckerTypeParams) (*TypeResponse, error) { |
no test coverage detected