mirror of
https://github.com/open-goal/jak-project
synced 2026-09-11 12:35:25 -04:00
goalc: save repl history when the compiler reloads
This commit is contained in:
@@ -71,6 +71,10 @@ Compiler::~Compiler() {
|
||||
}
|
||||
}
|
||||
|
||||
void Compiler::save_repl_history() {
|
||||
m_repl->save_history();
|
||||
}
|
||||
|
||||
void Compiler::print_to_repl(const std::string_view& str) {
|
||||
m_repl->print_to_repl(str);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class Compiler {
|
||||
public:
|
||||
Compiler(const std::string& user_profile = "#f", std::unique_ptr<ReplWrapper> repl = nullptr);
|
||||
~Compiler();
|
||||
void save_repl_history();
|
||||
void print_to_repl(const std::string_view& str);
|
||||
std::string get_prompt();
|
||||
std::string get_repl_input();
|
||||
|
||||
@@ -127,6 +127,9 @@ int main(int argc, char** argv) {
|
||||
if (status == ReplStatus::WANT_RELOAD) {
|
||||
fmt::print("Reloading compiler...\n");
|
||||
std::lock_guard<std::mutex> lock(compiler_mutex);
|
||||
if (compiler) {
|
||||
compiler->save_repl_history();
|
||||
}
|
||||
compiler = std::make_unique<Compiler>(username, std::make_unique<ReplWrapper>());
|
||||
status = ReplStatus::OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user