Reorganize some REPL modules

This commit is contained in:
Richard Feldman 2022-10-26 13:42:17 -04:00
parent 2e873d6a9a
commit 9f498add60
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
6 changed files with 401 additions and 288 deletions

View file

@ -272,8 +272,12 @@ pub async fn entrypoint_from_js(src: String) -> Result<String, String> {
// Transform the Expr to a string
// `Result::Err` becomes a JS exception that will be caught and displayed
match format_answer(arena, res_answer, expr_type_str) {
ReplOutput::NoProblems { expr, expr_type } => Ok(format!("{} : {}", expr, expr_type)),
match format_answer(arena, res_answer, expr_type_str, val_name) {
ReplOutput::NoProblems {
expr,
expr_type,
val_name,
} => Ok(format!("{expr} : {expr_type} # {val_name}")),
ReplOutput::Problems(lines) => Err(format!("\n{}\n", lines.join("\n\n"))),
}
}