frontend: update mie api usage to use new context parameter
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <ivy/lang/codegen.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <mie/convert.h>
|
||||
#include <mie/ctx.h>
|
||||
#include <mie/value.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
@@ -21,6 +22,7 @@ enum {
|
||||
|
||||
struct repl {
|
||||
bool r_show_lex, r_show_ast, r_show_ir;
|
||||
struct mie_ctx *r_mie;
|
||||
struct line_ed *r_ed;
|
||||
struct ivy_lexer *r_lex;
|
||||
struct ivy_parser *r_parse;
|
||||
@@ -115,6 +117,10 @@ static void repl_destroy(struct repl *repl)
|
||||
line_ed_destroy(repl->r_ed);
|
||||
}
|
||||
|
||||
if (repl->r_mie) {
|
||||
mie_ctx_destroy(repl->r_mie);
|
||||
}
|
||||
|
||||
free(repl);
|
||||
}
|
||||
|
||||
@@ -127,6 +133,12 @@ static enum ivy_status repl_create(struct repl **out)
|
||||
|
||||
memset(repl, 0x0, sizeof *repl);
|
||||
|
||||
repl->r_mie = mie_ctx_create();
|
||||
if (!repl->r_mie) {
|
||||
repl_destroy(repl);
|
||||
return IVY_ERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
repl->r_ed = line_ed_create();
|
||||
if (!repl->r_ed) {
|
||||
repl_destroy(repl);
|
||||
@@ -149,13 +161,14 @@ static enum ivy_status repl_create(struct repl **out)
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ivy_codegen_create(&repl->r_codegen);
|
||||
status = ivy_codegen_create(repl->r_mie, &repl->r_codegen);
|
||||
if (status != IVY_OK) {
|
||||
repl_destroy(repl);
|
||||
return status;
|
||||
}
|
||||
|
||||
repl->r_converter = mie_ir_converter_create(MIE_IR_MEM, MIE_IR_TEXT);
|
||||
repl->r_converter
|
||||
= mie_ir_converter_create(repl->r_mie, MIE_IR_MEM, MIE_IR_TEXT);
|
||||
if (!repl->r_converter) {
|
||||
repl_destroy(repl);
|
||||
return IVY_ERR_NO_MEMORY;
|
||||
|
||||
Reference in New Issue
Block a user