diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2022-12-24 13:17:47 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2023-02-10 12:07:02 +0000 |
commit | 99b497aa90ed7db99d29a301b47c91fba65c9cb3 (patch) | |
tree | 09e231f3a6838cdb2df9db9454981b9205046ba1 /cv.h | |
parent | b40895ae558e0aff0c347785dafeaaff40a01801 (diff) | |
download | perl-99b497aa90ed7db99d29a301b47c91fba65c9cb3.tar.gz |
Initial attack at basic 'class' feature
Adds a new experimental warning, feature, keywords and enough parsing to
implement basic classes with an empty `new` constructor method.
Inject a $self lexical into method bodies; populate it with the object instance, suitably shifted
Creates a new OP_METHSTART opcode to perform method setup
Define an aux flag to remark which stashes are classes
Basic implementation of fields.
Basic anonymous methods.
Diffstat (limited to 'cv.h')
-rw-r--r-- | cv.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -108,7 +108,7 @@ See L<perlguts/Autoloading with XSUBs>. ) /* CV has the `:method` attribute. This used to be called CVf_METHOD but is - * renamed to avoid collision with an upcoming feature */ + * renamed to avoid collision with CVf_IsMETHOD */ #define CVf_NOWARN_AMBIGUOUS 0x0001 #define CVf_LVALUE 0x0002 /* CV return value can be used as lvalue */ @@ -135,6 +135,9 @@ See L<perlguts/Autoloading with XSUBs>. #define CVf_ANONCONST 0x20000 /* :const - create anonconst op */ #define CVf_SIGNATURE 0x40000 /* CV uses a signature */ #define CVf_REFCOUNTED_ANYSV 0x80000 /* CvXSUBANY().any_sv is refcounted */ +#define CVf_IsMETHOD 0x100000 /* CV is a (real) method of a real class. Not + to be confused with what used to be called + CVf_METHOD; now CVf_NOWARN_AMBIGUOUS */ /* This symbol for optimised communication between toke.c and op.c: */ #define CVf_BUILTIN_ATTRS (CVf_NOWARN_AMBIGUOUS|CVf_LVALUE|CVf_ANONCONST) @@ -257,6 +260,10 @@ Helper macro to turn off the C<CvREFCOUNTED_ANYSV> flag. #define CvREFCOUNTED_ANYSV_on(cv) (CvFLAGS(cv) |= CVf_REFCOUNTED_ANYSV) #define CvREFCOUNTED_ANYSV_off(cv) (CvFLAGS(cv) &= ~CVf_REFCOUNTED_ANYSV) +#define CvIsMETHOD(cv) (CvFLAGS(cv) & CVf_IsMETHOD) +#define CvIsMETHOD_on(cv) (CvFLAGS(cv) |= CVf_IsMETHOD) +#define CvIsMETHOD_off(cv) (CvFLAGS(cv) &= ~CVf_IsMETHOD) + /* Back-compat */ #ifndef PERL_CORE # define CVf_METHOD CVf_NOWARN_AMBIGUOUS |