processArrayType converts array types to Schema.Array (wrapping in Schema.mutable for non-readonly).
(t *checker.Type, ctx processingContext)
| 393 | |
| 394 | // processArrayType converts array types to Schema.Array (wrapping in Schema.mutable for non-readonly). |
| 395 | func (g *StructuralSchemaGen) processArrayType(t *checker.Type, ctx processingContext) (*ast.Node, bool, error) { |
| 396 | typeArgs := checker.Checker_getTypeArguments(g.Checker, t) |
| 397 | if len(typeArgs) == 0 { |
| 398 | return nil, false, errors.New("array type has no type arguments") |
| 399 | } |
| 400 | |
| 401 | elemSchema, err := g.processType(typeArgs[0], ctx) |
| 402 | if err != nil { |
| 403 | return nil, false, err |
| 404 | } |
| 405 | expr := g.createApiCall("Array", []*ast.Node{elemSchema}) |
| 406 | if checker.Checker_isReadonlyArrayType(g.Checker, t) { |
| 407 | return expr, false, nil |
| 408 | } |
| 409 | return g.createApiCall("mutable", []*ast.Node{expr}), false, nil |
| 410 | } |
| 411 | |
| 412 | // processTupleType converts tuple types to Schema.Tuple. |
| 413 | func (g *StructuralSchemaGen) processTupleType(t *checker.Type, ctx processingContext) (*ast.Node, bool, error) { |
no test coverage detected