summaryrefslogtreecommitdiff
path: root/lib/B
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 /lib/B
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 'lib/B')
-rw-r--r--lib/B/Deparse-core.t4
-rw-r--r--lib/B/Op_private.pm1
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/B/Deparse-core.t b/lib/B/Deparse-core.t
index 48d23f7dce..378365e5e9 100644
--- a/lib/B/Deparse-core.t
+++ b/lib/B/Deparse-core.t
@@ -354,6 +354,7 @@ my %not_tested = map { $_ => 1} qw(
__FILE__
__LINE__
__PACKAGE__
+ ADJUST
AUTOLOAD
BEGIN
CHECK
@@ -363,10 +364,12 @@ my %not_tested = map { $_ => 1} qw(
INIT
UNITCHECK
catch
+ class
default
defer
else
elsif
+ field
finally
for
foreach
@@ -374,6 +377,7 @@ my %not_tested = map { $_ => 1} qw(
given
if
m
+ method
no
package
q
diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm
index 173e07b6c6..8d20e0278c 100644
--- a/lib/B/Op_private.pm
+++ b/lib/B/Op_private.pm
@@ -443,6 +443,7 @@ $bits{method_named}{0} = $bf[0];
$bits{method_redir}{0} = $bf[0];
$bits{method_redir_super}{0} = $bf[0];
$bits{method_super}{0} = $bf[0];
+$bits{methstart}{0} = $bf[0];
@{$bits{mkdir}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]);
@{$bits{modulo}}{1,0} = ($bf[1], $bf[1]);
@{$bits{msgctl}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]);