| 1439 | std::string ParserVisitor::ErrorMessage() { return factory_.ErrorMessage(); } |
| 1440 | |
| 1441 | Expr ParserVisitor::GlobalCallOrMacroImpl(int64_t expr_id, |
| 1442 | absl::string_view function, |
| 1443 | std::vector<Expr> args) { |
| 1444 | if (auto macro = macro_registry_.FindMacro(function, args.size(), false); |
| 1445 | macro) { |
| 1446 | std::vector<Expr> macro_args; |
| 1447 | if (add_macro_calls_) { |
| 1448 | macro_args.reserve(args.size()); |
| 1449 | for (const auto& arg : args) { |
| 1450 | macro_args.push_back(factory_.BuildMacroCallArg(arg)); |
| 1451 | } |
| 1452 | } |
| 1453 | factory_.BeginMacro(factory_.GetSourceRange(expr_id)); |
| 1454 | auto expr = macro->Expand(factory_, absl::nullopt, absl::MakeSpan(args)); |
| 1455 | factory_.EndMacro(); |
| 1456 | if (expr) { |
| 1457 | if (add_macro_calls_) { |
| 1458 | factory_.AddMacroCall(expr->id(), function, absl::nullopt, |
| 1459 | std::move(macro_args)); |
| 1460 | } |
| 1461 | // We did not end up using `expr_id`. Delete metadata. |
| 1462 | factory_.EraseId(expr_id); |
| 1463 | return std::move(*expr); |
| 1464 | } |
| 1465 | } |
| 1466 | |
| 1467 | return factory_.NewCall(expr_id, function, std::move(args)); |
| 1468 | } |
| 1469 | |
| 1470 | Expr ParserVisitor::ReceiverCallOrMacroImpl(int64_t expr_id, |
| 1471 | absl::string_view function, |
nothing calls this directly
no test coverage detected