mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
Obj: Implement with_location_of() as template
This commit is contained in:
parent
e5bb63c662
commit
caa1c7493f
3 changed files with 8 additions and 44 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue