fixed to clear inner data upon an error in the interactive mode
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-16 19:40:43 +09:00
parent c795b28cb8
commit f08ba4cd12
6 changed files with 36 additions and 16 deletions

View File

@ -533,14 +533,13 @@ static int on_fed_cnode_in_interactive_mode (hcl_t* hcl, hcl_cnode_t* obj)
if (hcl_compile(hcl, obj, flags) <= -1)
{
print_error(hcl, "failed to compile");
/*print_error(hcl, "failed to compile"); */
xtn->feed.pos = xtn->feed.len; /* arrange to discard the rest of the line */
}
else
{
xtn->feed.ncompexprs++;
return -1; /* this causes the feed function to fail and
the error hander for to print the error message */
}
xtn->feed.ncompexprs++;
return 0;
}
@ -641,6 +640,11 @@ static int feed_loop (hcl_t* hcl, xtn_t* xtn, int verbose)
{
print_error (hcl, "failed to feed");
if (len > 0) show_prompt (hcl, 0);
/* clear the compiled code but not executed yet */
hcl_clearcode(hcl);
hcl_clearfnblks(hcl);
xtn->feed.ncompexprs = 0;
}
else
{