summaryrefslogtreecommitdiff
path: root/proto.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 /proto.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 'proto.h')
-rw-r--r--proto.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 48c7c7d42f..8e9158412e 100644
--- a/proto.h
+++ b/proto.h
@@ -6231,6 +6231,44 @@ S_get_aux_mg(pTHX_ AV *av);
assert(av)
#endif /* defined(PERL_IN_AV_C) */
+#if defined(PERL_IN_CLASS_C) || defined(PERL_IN_PAD_C) || \
+ defined(PERL_IN_PERLY_C) || defined(PERL_IN_TOKE_C)
+PERL_CALLCONV void
+Perl_class_add_ADJUST(pTHX_ HV *stash, CV *cv);
+# define PERL_ARGS_ASSERT_CLASS_ADD_ADJUST \
+ assert(stash); assert(cv)
+
+PERL_CALLCONV void
+Perl_class_add_field(pTHX_ HV *stash, PADNAME *pn);
+# define PERL_ARGS_ASSERT_CLASS_ADD_FIELD \
+ assert(stash); assert(pn)
+
+PERL_CALLCONV void
+Perl_class_prepare_method_parse(pTHX_ CV *cv);
+# define PERL_ARGS_ASSERT_CLASS_PREPARE_METHOD_PARSE \
+ assert(cv)
+
+PERL_CALLCONV void
+Perl_class_seal_stash(pTHX_ HV *stash);
+# define PERL_ARGS_ASSERT_CLASS_SEAL_STASH \
+ assert(stash)
+
+PERL_CALLCONV void
+Perl_class_setup_stash(pTHX_ HV *stash);
+# define PERL_ARGS_ASSERT_CLASS_SETUP_STASH \
+ assert(stash)
+
+PERL_CALLCONV OP *
+Perl_class_wrap_method_body(pTHX_ OP *o);
+# define PERL_ARGS_ASSERT_CLASS_WRAP_METHOD_BODY
+
+PERL_CALLCONV void
+Perl_croak_kw_unless_class(pTHX_ const char *kw);
+# define PERL_ARGS_ASSERT_CROAK_KW_UNLESS_CLASS \
+ assert(kw)
+
+#endif /* defined(PERL_IN_CLASS_C) || defined(PERL_IN_PAD_C) || \
+ defined(PERL_IN_PERLY_C) || defined(PERL_IN_TOKE_C) */
#if defined(PERL_IN_DEB_C)
STATIC void
S_deb_stack_n(pTHX_ SV **stack_base, I32 stack_min, I32 stack_max, I32 mark_min, I32 mark_max);