(opName string, o *OverloadDecl)
| 1273 | } |
| 1274 | |
| 1275 | func formatOperator(opName string, o *OverloadDecl) string { |
| 1276 | args := o.ArgTypes() |
| 1277 | argTypes := make([]string, len(o.ArgTypes())) |
| 1278 | for j, a := range args { |
| 1279 | argTypes[j] = describeCELType(a) |
| 1280 | } |
| 1281 | ret := describeCELType(o.ResultType()) |
| 1282 | switch len(args) { |
| 1283 | case 1: |
| 1284 | return fmt.Sprintf("%s%s -> %s", opName, argTypes[0], ret) |
| 1285 | case 2: |
| 1286 | if opName == operators.Index { |
| 1287 | return fmt.Sprintf("%s[%s] -> %s", argTypes[0], argTypes[1], ret) |
| 1288 | } |
| 1289 | return fmt.Sprintf("%s %s %s -> %s", argTypes[0], opName, argTypes[1], ret) |
| 1290 | default: |
| 1291 | if opName == operators.Conditional { |
| 1292 | return fmt.Sprint("bool ? <T> : <T> -> <T>") |
| 1293 | } |
| 1294 | return formatCall(opName, o) |
| 1295 | } |
| 1296 | } |
| 1297 | |
| 1298 | func formatCall(funcName string, o *OverloadDecl) string { |
| 1299 | args := make([]string, len(o.ArgTypes())) |
no test coverage detected