void Action::apply(City &city, Goods &turnGoods) { processApply(city, turnGoods); }
bool ControlBodyTranslator::preorder(const IR::MethodCallExpression* expression) { builder->append("/* "); visit(expression->method); builder->append("("); bool first = true; for (auto a : *expression->arguments) { if (!first) builder->append(", "); first = false; visit(a); } builder->append(")"); builder->append("*/"); builder->newline(); auto mi = P4::MethodInstance::resolve(expression, control->program->refMap, control->program->typeMap); auto apply = mi->to<P4::ApplyMethod>(); if (apply != nullptr) { processApply(apply); return false; } auto ef = mi->to<P4::ExternFunction>(); if (ef != nullptr) { processFunction(ef); return false; } auto ext = mi->to<P4::ExternMethod>(); if (ext != nullptr) { processMethod(ext); return false; } auto bim = mi->to<P4::BuiltInMethod>(); if (bim != nullptr) { builder->emitIndent(); if (bim->name == IR::Type_Header::isValid) { visit(bim->appliedTo); builder->append(".ebpf_valid"); return false; } else if (bim->name == IR::Type_Header::setValid) { visit(bim->appliedTo); builder->append(".ebpf_valid = true"); return false; } else if (bim->name == IR::Type_Header::setInvalid) { visit(bim->appliedTo); builder->append(".ebpf_valid = false"); return false; } } auto ac = mi->to<P4::ActionCall>(); if (ac != nullptr) { // Action arguments have been eliminated by the mid-end. BUG_CHECK(expression->arguments->size() == 0, "%1%: unexpected arguments for action call", expression); visit(ac->action->body); return false; } ::error("Unsupported method invocation %1%", expression); return false; }