Obj: Implement with_location_of() as template

This commit is contained in:
Arne Welzel 2024-02-06 10:45:49 +01:00
parent e5bb63c662
commit caa1c7493f
3 changed files with 8 additions and 44 deletions

View file

@ -49,6 +49,13 @@ inline void set_location(const Location start, const Location end) {
end_location = end;
}
// Helper for updating e's location to the one used by o, returning e.
template<typename T, typename U>
T with_location_of(T e, const U& o) {
e->SetLocationInfo(o->GetLocationInfo());
return e;
}
} // namespace detail
class Obj {