File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ namespace pl::core {
100100 ~UpdateHandler ();
101101
102102 Evaluator *evaluator;
103+ const ast::ASTNode *node = nullptr ;
104+ u64 offset = 0 ;
103105 };
104106
105107 struct StackTrace {
Original file line number Diff line number Diff line change @@ -1155,20 +1155,18 @@ namespace pl::core {
11551155 evaluator->m_lastPauseLine = std::nullopt ;
11561156 }
11571157 }
1158- evaluator->m_callStack .emplace_back (node->clone (), evaluator->getReadOffset ());
1158+ this ->node = node;
1159+ this ->offset = evaluator->getReadOffset ();
11591160 }
11601161 }
11611162
11621163 Evaluator::UpdateHandler::~UpdateHandler () {
11631164 if (evaluator->m_evaluated )
11641165 return ;
11651166
1166- // Don't pop scopes if an exception is currently being thrown so we can generate
1167- // a stack trace
1168- if (std::uncaught_exceptions () > 0 )
1169- return ;
1170-
1171- evaluator->m_callStack .pop_back ();
1167+ if (std::uncaught_exceptions () > 0 ) [[unlikely]]
1168+ if (node != nullptr )
1169+ evaluator->m_callStack .emplace_back (node->clone (), offset);
11721170 }
11731171
11741172 Evaluator::UpdateHandler Evaluator::updateRuntime (const ast::ASTNode *node) {
Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ namespace pl {
267267
268268 const auto &callStack = evaluator->getCallStack ();
269269 u32 lastLine = 0 ;
270- for (const auto &entry : callStack | std::views::reverse ) {
270+ for (const auto &entry : callStack) {
271271 const auto &[node, address] = entry;
272272 if (node == nullptr )
273273 continue ;
You can’t perform that action at this time.
0 commit comments