compileFunctions creates a CompiledFunction for each overload of each function in the catalog.
()
| 216 | |
| 217 | // compileFunctions creates a CompiledFunction for each overload of each function in the catalog. |
| 218 | func compileFunctions() { |
| 219 | for funcName, overloads := range Catalog { |
| 220 | compileNonOperatorFunction(funcName, overloads) |
| 221 | } |
| 222 | |
| 223 | // Build the overload for all unary and binary functions based on their operator. This will be used for fallback if |
| 224 | // an exact match is not found. Compiled functions (which wrap the overload deducer) handle upcasting and other |
| 225 | // special rules, so it's far more efficient to reuse it for operators. Operators are also a special case since they |
| 226 | // all have different names, while standard overload deducers work on a function-name basis. |
| 227 | for signature, functionOverload := range unaryFunctions { |
| 228 | overloads, ok := unaryOperatorOverloads[signature.Operator] |
| 229 | if !ok { |
| 230 | overloads = NewOverloads() |
| 231 | unaryOperatorOverloads[signature.Operator] = overloads |
| 232 | } |
| 233 | if err := overloads.Add(functionOverload); err != nil { |
| 234 | panic(err) |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | for signature, functionOverload := range binaryFunctions { |
| 239 | overloads, ok := binaryOperatorOverloads[signature.Operator] |
| 240 | if !ok { |
| 241 | overloads = NewOverloads() |
| 242 | binaryOperatorOverloads[signature.Operator] = overloads |
| 243 | } |
| 244 | if err := overloads.Add(functionOverload); err != nil { |
| 245 | panic(err) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // Add all permutations for the unary and binary operators |
| 250 | for operator, overload := range unaryOperatorOverloads { |
| 251 | unaryOperatorPermutations[operator] = overload.overloadsForParams(1) |
| 252 | } |
| 253 | for operator, overload := range binaryOperatorOverloads { |
| 254 | binaryOperatorPermutations[operator] = overload.overloadsForParams(2) |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | func compileAggs() { |
| 259 | for funcName, overloads := range AggregateCatalog { |
no test coverage detected