wrapProjected builds a viewed result type by wrapping the given projected in a result type with "projected" and "view" attributes.
(projected expr.UserType)
| 2094 | // wrapProjected builds a viewed result type by wrapping the given projected |
| 2095 | // in a result type with "projected" and "view" attributes. |
| 2096 | func wrapProjected(projected expr.UserType) expr.UserType { |
| 2097 | rt := projected.(*expr.ResultTypeExpr) |
| 2098 | pratt := &expr.NamedAttributeExpr{ |
| 2099 | Name: "projected", |
| 2100 | Attribute: &expr.AttributeExpr{Type: rt, Description: "Type to project"}, |
| 2101 | } |
| 2102 | prview := &expr.NamedAttributeExpr{ |
| 2103 | Name: "view", |
| 2104 | Attribute: &expr.AttributeExpr{Type: expr.String, Description: "View to render"}, |
| 2105 | } |
| 2106 | return &expr.ResultTypeExpr{ |
| 2107 | UserTypeExpr: &expr.UserTypeExpr{ |
| 2108 | AttributeExpr: &expr.AttributeExpr{ |
| 2109 | Type: &expr.Object{pratt, prview}, |
| 2110 | Validation: &expr.ValidationExpr{Required: []string{"projected", "view"}}, |
| 2111 | }, |
| 2112 | TypeName: rt.TypeName, |
| 2113 | }, |
| 2114 | Identifier: rt.Identifier, |
| 2115 | Views: rt.Views, |
| 2116 | } |
| 2117 | } |
| 2118 | |
| 2119 | // buildTypeInits builds the data to generate the constructor code to |
| 2120 | // initialize a result type from a projected type. |
no outgoing calls
no test coverage detected