1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:07:34 +00:00

LibJS: Track source positions all the way down to exceptions

This makes exceptions have a trace of source positions too, which could
probably be helpful in making fancier error tracebacks.
This commit is contained in:
AnotherTest 2020-12-28 20:45:22 +03:30 committed by Andreas Kling
parent f17874ecd2
commit b34b681811
10 changed files with 647 additions and 245 deletions

View file

@ -29,6 +29,7 @@
#include <AK/Vector.h>
#include <LibJS/Runtime/Cell.h>
#include <LibJS/Runtime/Value.h>
#include <LibJS/SourceRange.h>
namespace JS {
@ -39,6 +40,7 @@ public:
Value value() const { return m_value; }
const Vector<String>& trace() const { return m_trace; }
const Vector<SourceRange>& source_ranges() const { return m_source_ranges; }
private:
virtual const char* class_name() const override { return "Exception"; }
@ -46,6 +48,7 @@ private:
Value m_value;
Vector<String> m_trace;
Vector<SourceRange> m_source_ranges;
};
}