From: Eric S. Raymond Date: Thu, 3 Nov 1994 18:54:11 +0000 (+0000) Subject: Label patching seems to work OK. X-Git-Tag: 1-2~88 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=0d4a7cadf00ad8df1cf59839adbc0e1fa1103202;p=cupl.git Label patching seems to work OK. --- diff --git a/interpret.c b/interpret.c index 10f1497..f6cf6c2 100644 --- a/interpret.c +++ b/interpret.c @@ -240,16 +240,25 @@ static bool r_label_rewrite(node *tp) * KISS -- this code may do extra work, but it needs no special * knowledge about node types. */ - if (!ATOMIC(tp->type)) + if (LABELREF(tp->type)) { node *left = tp->u.n.left; node *right = tp->u.n.right; if (left && left->type == IDENTIFIER && left->syminf->labelref) + { +#ifdef ODEBUG + (void) printf("patching label reference to %s\n", left->u.string); +#endif /* ODEBUG */ left = left->syminf->target; - + } if (right && right->type == IDENTIFIER && right->syminf->labelref) + { +#ifdef ODEBUG + (void) printf("patching label reference to %s\n", right->u.string); +#endif /* ODEBUG */ right = right->syminf->target; + } } return(TRUE); @@ -265,10 +274,10 @@ static void rewrite(node *tree) if (np->u.n.left->type == LABEL) np->u.n.left->u.n.left->syminf->target = np; -#ifdef _FOO_ /* now, hack label references to eliminate name references */ recursive_apply(tree, r_label_rewrite); +#ifdef _FOO_ /* pull blocks out of the main line */ for_cdr(np, tree) if (np->u.n.left->type==LABEL && np->u.n.left->u.n.right->type==BLOCK)