summaryrefslogtreecommitdiff
path: root/embed.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 /embed.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 'embed.h')
-rw-r--r--embed.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/embed.h b/embed.h
index 76e3b9f9dc..20f3654d43 100644
--- a/embed.h
+++ b/embed.h
@@ -1972,6 +1972,17 @@
# define my_pclose(a) Perl_my_pclose(aTHX_ a)
# define my_popen(a,b) Perl_my_popen(aTHX_ a,b)
# endif /* !defined(PERL_IMPLICIT_SYS) */
+# if defined(PERL_IN_CLASS_C) || defined(PERL_IN_PAD_C) || \
+ defined(PERL_IN_PERLY_C) || defined(PERL_IN_TOKE_C)
+# define class_add_ADJUST(a,b) Perl_class_add_ADJUST(aTHX_ a,b)
+# define class_add_field(a,b) Perl_class_add_field(aTHX_ a,b)
+# define class_prepare_method_parse(a) Perl_class_prepare_method_parse(aTHX_ a)
+# define class_seal_stash(a) Perl_class_seal_stash(aTHX_ a)
+# define class_setup_stash(a) Perl_class_setup_stash(aTHX_ a)
+# define class_wrap_method_body(a) Perl_class_wrap_method_body(aTHX_ a)
+# define croak_kw_unless_class(a) Perl_croak_kw_unless_class(aTHX_ a)
+# 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_REGEX_ENGINE)
# define check_regnode_after(a,b) Perl_check_regnode_after(aTHX_ a,b)
# define regnext(a) Perl_regnext(aTHX_ a)