diff options
author | John Hodge <tpg@mutabah.net> | 2016-05-24 18:57:39 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-05-24 18:57:39 +0800 |
commit | 74868acb8e3db00cbab565abd6fbd76cbf763674 (patch) | |
tree | 1e3d1f59182df3e11b3726a4ceeb989596a4e6a6 /src/include | |
parent | 66b9f2589107f60041f024873512f93c9c8aee63 (diff) | |
download | mrust-74868acb8e3db00cbab565abd6fbd76cbf763674.tar.gz |
AST - Spanned paths in impl blocks, remove dead code
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/serialise.hpp | 6 | ||||
-rw-r--r-- | src/include/span.hpp | 8 |
2 files changed, 11 insertions, 3 deletions
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<typename T> void item(::std::vector<T>& 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<typename T> struct Spanned { - Span m_span; - T m_item; + Span sp; + T ent; }; +template<typename T> +Spanned<T> make_spanned(Span sp, T val) { + return Spanned<T> { ::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) |