summaryrefslogtreecommitdiff
path: root/src/include/span.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/span.hpp')
-rw-r--r--src/include/span.hpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/include/span.hpp b/src/include/span.hpp
index 49169e5b..05417a83 100644
--- a/src/include/span.hpp
+++ b/src/include/span.hpp
@@ -17,6 +17,8 @@ enum WarningType
W0000,
};
+class Position;
+
struct ProtoSpan
{
::std::string filename;
@@ -40,6 +42,8 @@ struct Span
end_line(end_line),
end_ofs(end_ofs)
{}
+ Span(const Span& x);
+ Span(const Position& position);
Span():
filename("")/*,
start_line(0), start_ofs(0),
@@ -59,7 +63,7 @@ struct Spanned
T m_item;
};
-#define ERROR(span, code, msg) do { (span).error(code, [&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Error fell through" #code); } while(0)
-#define BUG(span, msg) do { (span).bug([&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Bug fell through"); } while(0)
-#define TODO(span, msg) do { (span).bug([&](::std::ostream& os) { os << "TODO: " << msg; }); throw ::std::runtime_error("Bug (todo) fell through"); } while(0)
+#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 BUG(span, msg) do { ::Span(span).bug([&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Bug fell through"); } while(0)
+#define TODO(span, msg) do { ::Span(span).bug([&](::std::ostream& os) { os << "TODO: " << msg; }); throw ::std::runtime_error("Bug (todo) fell through"); } while(0)