| 357 | } |
| 358 | |
| 359 | string expand_ellipses(const string& signature, const Array<shared_ptr<CoefficientFunction>>& cfs) |
| 360 | { |
| 361 | auto parts = split_signature(signature); |
| 362 | if (parts.size() - 1 != cfs.Size()) |
| 363 | throw NG_EXCEPTION( |
| 364 | string("number of inputs (") + to_string(cfs.Size()) + ") " + |
| 365 | "does not match the number inferred from the signature (" |
| 366 | + to_string(parts.size() - 1) + ")"); |
| 367 | |
| 368 | string ellipse_symbols{}; |
| 369 | ellipse_symbols.reserve(10); |
| 370 | for (auto i : Range(parts.size() - 1)) |
| 371 | tie(parts[i], ellipse_symbols) = expand_ellipse(parts[i], cfs[i], signature, ellipse_symbols); |
| 372 | |
| 373 | auto pos = parts.back().find("..."); |
| 374 | if (pos != string::npos) |
| 375 | parts.back() = replace_ellipse(parts.back(), pos, ellipse_symbols.size(), ellipse_symbols); |
| 376 | |
| 377 | for (const auto& part : parts) |
| 378 | if (part.find("...") != string::npos) |
| 379 | throw NG_EXCEPTION(string("could not expand all ellipses in signature ") + signature); |
| 380 | |
| 381 | return form_index_signature(parts); |
| 382 | } |
| 383 | |
| 384 | optional<string> substitute_id_index(string signature, pair<char, char> id_indices, |
| 385 | size_t id_pos, const FlatArray<bool> marked_for_removal, |
no test coverage detected