Files
whetstone_DSL/editor/src/CrossLanguageStepIntoHandler.h

37 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include "PolyglotStackTraceDecoder.h"
#include "DebugAdapterRouter.h"
#include <string>
#include <vector>
namespace whetstone {
struct StepIntoResult {
bool switched = false;
std::string previousLanguage;
std::string newLanguage;
int targetFrameId = -1;
};
class CrossLanguageStepIntoHandler {
public:
// Step-into at a boundary: switch active adapter to the next frame's language.
StepIntoResult stepInto(const StackFrame& frame,
DebugAdapterRouter& router,
const std::vector<StackFrame>& frames,
int frameIndex) const {
int next = frameIndex + 1;
if (!frame.isBoundary ||
next >= static_cast<int>(frames.size()) ||
frames[next].language == frame.language)
return {false, "", "", -1};
std::string prev = router.getActiveLanguage();
std::string newLang = frames[next].language;
router.setActiveLanguage(newLang);
return {true, prev, newLang, frames[next].id};
}
};
} // namespace whetstone