improved override
This commit is contained in:
@@ -3,4 +3,5 @@ a
|
||||
: call_a a a a ;
|
||||
call_a
|
||||
: a 7 . ;
|
||||
a
|
||||
call_a
|
||||
|
||||
+1
-8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user