"weak" lock keyword (hardcoded initial implementation) now works.
Gurusamy Sarathy [Tue, 11 Nov 1997 00:26:09 +0000 (00:26 +0000)]
if not defined(&Thread::join) and defined(&__PACKAGE__::lock), 'lock'
is recognized as a sub, a regular keyword otherwise.  Could be
generalized by storing a flag for every op in OP struct, and turning
the flag off when Thread.xs loads.

p4raw-id: //depot/win32/perl@225

toke.c

diff --git a/toke.c b/toke.c
index df5e0eb..07a1656 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2603,7 +2603,13 @@ yylex()
                  (gv = *gvp) != (GV*)&sv_undef &&
                  GvCVu(gv) && GvIMPORTED_CV(gv))))
            {
-               tmp = 0;
+               tmp = 0;                /* overridden by importation */
+           }
+           else if (gv && !gvp
+                    && -tmp==KEY_lock  /* XXX generalizable kludge */
+                    && !gv_fetchpv("Thread::join",FALSE,SVt_PVCV))
+           {
+               tmp = 0;                /* any sub overrides "weak" keyword */
            }
            else {
                tmp = -tmp; gv = Nullgv; gvp = 0;