xo-interpreter2 stack: work on runtime error representation [WIP]
This commit is contained in:
parent
83156ef2d0
commit
ce5232efd9
18 changed files with 524 additions and 27 deletions
61
xo-object2/include/xo/object2/DRuntimeError.hpp
Normal file
61
xo-object2/include/xo/object2/DRuntimeError.hpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/** @file DRuntimeError.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Feb 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "String.hpp"
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
||||
/** @brief representation for runtime errors
|
||||
**/
|
||||
class DRuntimeError {
|
||||
public:
|
||||
using ACollector = xo::mm::ACollector;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using ppindentinfo = xo::print::ppindentinfo;
|
||||
|
||||
public:
|
||||
/** create instance using memory from allocator @p mm
|
||||
* @p src_fn identifies the (c++) function/method in which
|
||||
* error detercted.
|
||||
* @p error_descr contains human-readable error message;
|
||||
* will be copied by this function.
|
||||
**/
|
||||
DRuntimeError * _make(obj<AAllocator> mm,
|
||||
DString * src_fn,
|
||||
DString * error_descr);
|
||||
|
||||
/** @defgroup scm-runtimeerror-printable-facet printable facet **/
|
||||
///@{
|
||||
|
||||
bool pretty(const ppindentinfo & ppii) const;
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-runtimeerror-gcobject-facet gcobject facet **/
|
||||
///@{
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DRuntimeError * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
///@}
|
||||
|
||||
private:
|
||||
DRuntimeError(DString * src_fn, DString * error_descr);
|
||||
|
||||
private:
|
||||
/** source location at which error identified **/
|
||||
DString * src_function_ = nullptr;
|
||||
/** error description (allocated from ErrorArena) **/
|
||||
DString * error_descr_ = nullptr;
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DRuntimeError.hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue