improved override

This commit is contained in:
2021-11-13 22:39:09 +01:00
parent 3c57373992
commit f013e52c94
2 changed files with 2 additions and 8 deletions
+1
View File
@@ -3,4 +3,5 @@ a
: call_a a a a ;
call_a
: a 7 . ;
a
call_a
+1 -8
View File
@@ -302,13 +302,6 @@ static enum fh_error w_colon(struct fh_thread_s *fh, const struct fh_word_s *w)
return FH_OK;
}
static enum fh_error w_redirect(struct fh_thread_s *fh, const struct fh_word_s *w)
{
const struct fh_word_s *w2 = &fh->dict[w->param];
LOG("REDIRECT to %s", w2->name);
return w2->handler(fh, w2);
}
static enum fh_error w_semicolon(struct fh_thread_s *fh, const struct fh_word_s *w0)
{
(void) w0;
@@ -331,7 +324,7 @@ static enum fh_error w_semicolon(struct fh_thread_s *fh, const struct fh_word_s
if (0 == strncasecmp(new_word->name, old_word->name, MAX_NAME_LEN)) {
// We can't move the new definition because of RECURSE already using its address.
// Instead, redirect and wipe the old name.
old_word->handler = w_redirect;
// Note that this leaks compile memory!
old_word->start = new_word->start;
old_word->name[0] = 0;
break;