From 74868acb8e3db00cbab565abd6fbd76cbf763674 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 24 May 2016 18:57:39 +0800 Subject: AST - Spanned paths in impl blocks, remove dead code --- src/include/serialise.hpp | 6 +++++- src/include/span.hpp | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/include') diff --git a/src/include/serialise.hpp b/src/include/serialise.hpp index 9af379e7..31abc358 100644 --- a/src/include/serialise.hpp +++ b/src/include/serialise.hpp @@ -130,7 +130,11 @@ public: virtual void end_object(const char *tag) = 0; ::std::string start_object(); - void item(Serialisable& v); + void item(Serialisable& v); + Deserialiser& operator>>(Serialisable& v) { + this->item(v); + return *this; + } template void item(::std::vector& v) { diff --git a/src/include/span.hpp b/src/include/span.hpp index f57fa8a9..e7bd2694 100644 --- a/src/include/span.hpp +++ b/src/include/span.hpp @@ -56,9 +56,13 @@ struct Span template struct Spanned { - Span m_span; - T m_item; + Span sp; + T ent; }; +template +Spanned make_spanned(Span sp, T val) { + return Spanned { ::std::move(sp), ::std::move(val) }; +} #define ERROR(span, code, msg) do { ::Span(span).error(code, [&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Error fell through" #code); } while(0) #define WARNING(span, code, msg) do { ::Span(span).warning(code, [&](::std::ostream& os) { os << msg; }); } while(0) -- cgit v1.2.3