summaryrefslogtreecommitdiff
path: root/hv.h
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2022-12-24 13:17:47 +0000
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2023-02-10 12:07:02 +0000
commit99b497aa90ed7db99d29a301b47c91fba65c9cb3 (patch)
tree09e231f3a6838cdb2df9db9454981b9205046ba1 /hv.h
parentb40895ae558e0aff0c347785dafeaaff40a01801 (diff)
downloadperl-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 'hv.h')
-rw-r--r--hv.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/hv.h b/hv.h
index c005ec653a..7866dea540 100644
--- a/hv.h
+++ b/hv.h
@@ -132,10 +132,19 @@ struct xpvhv_aux {
used to detect each() after insert for warnings */
#endif
U32 xhv_aux_flags; /* assorted extra flags */
+
+ /* The following fields are only valid if we have the flag HvAUXf_IS_CLASS */
+ AV *xhv_class_adjust_blocks; /* CVs containing the ADJUST blocks */
+ PADNAMELIST *xhv_class_fields; /* PADNAMEs with PadnameIsFIELD() */
+ PADOFFSET xhv_class_next_fieldix;
};
#define HvAUXf_SCAN_STASH 0x1 /* stash is being scanned by gv_check */
#define HvAUXf_NO_DEREF 0x2 /* @{}, %{} etc (and nomethod) not present */
+#define HvAUXf_IS_CLASS 0x4 /* the package is a 'class' */
+
+#define HvSTASH_IS_CLASS(hv) \
+ (HvHasAUX(hv) && HvAUX(hv)->xhv_aux_flags & HvAUXf_IS_CLASS)
/* hash structure: */
/* This structure must match the beginning of struct xpvmg in sv.h. */