Skip to content

Commit

Permalink
Initial attack at basic 'class' feature
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
leonerd committed Feb 10, 2023
1 parent b40895a commit 99b497a
Show file tree
Hide file tree
Showing 47 changed files with 3,719 additions and 2,020 deletions.
9 changes: 9 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ caretx.c C file to create $^X
cflags.SH A script that emits C compilation flags per file
Changes Describe how to peruse changes between releases
charclass_invlists.h Compiled-in inversion lists
class.c Internals of the `use feature 'class'` object system
CODE_OF_CONDUCT.md Information on where to find the Standards of Conduct
config_h.SH Produces config.h
configpm Produces lib/Config.pm
Expand Down Expand Up @@ -5638,6 +5639,12 @@ t/bigmem/regexp.t Test regular expressions with large strings
t/bigmem/subst.t Test s/// with large strings
t/bigmem/vec.t Check vec() handles large offsets
t/charset_tools.pl To aid in portable testing across platforms with different character sets
t/class/class.t See if class declarations work
t/class/construct.t See if class constructors work
t/class/destruct.t See if class destruction works
t/class/field.t See if class field declarations work
t/class/method.t See if class method declarations work
t/class/phasers.t See if class phaser blocks work
t/cmd/elsif.t See if else-if works
t/cmd/for.t See if for loops work
t/cmd/mod.t See if statement modifiers work
Expand Down Expand Up @@ -5721,6 +5728,7 @@ t/lib/common.pl Helper for lib/{warnings,feature}.t
t/lib/commonsense.t See if configuration meets basic needs
t/lib/Count.pm Helper for t/op/method.t
t/lib/croak.t Test calls to Perl_croak() in the C source.
t/lib/croak/class Test croak calls from class.c
t/lib/croak/gv Test croak calls from gv.c
t/lib/croak/mg Test croak calls from mg.c
t/lib/croak/op Test croak calls from op.c
Expand Down Expand Up @@ -5787,6 +5795,7 @@ t/lib/warnings/9enabled Tests warnings
t/lib/warnings/9uninit Tests "Use of uninitialized" warnings
t/lib/warnings/av Tests for av.c for warnings.t
t/lib/warnings/builtin Tests for builtin.c for warnings.t
t/lib/warnings/class Tests for class.c for warnings.t
t/lib/warnings/doio Tests for doio.c for warnings.t
t/lib/warnings/gv Tests for gv.c for warnings.t
t/lib/warnings/hv Tests for hv.c for warnings.t
Expand Down
4 changes: 2 additions & 2 deletions Makefile.SH
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ h = $(h1) $(h2) $(h3) $(h4) $(h5) $(h6)
c1 = av.c scope.c op.c peep.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro_core.c perl.c
c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c utf8.c sv.c
c3 = taint.c toke.c util.c deb.c run.c builtin.c universal.c pad.c globals.c keywords.c
c3 = taint.c toke.c util.c deb.c run.c builtin.c universal.c class.c pad.c globals.c keywords.c
c4 = perlio.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c dquote.c time64.c
c5 = regcomp.c regcomp_debug.c regcomp_invlist.c regcomp_study.c regcomp_trie.c regexec.c
c6 = $(mallocsrc)
Expand All @@ -559,7 +559,7 @@ c = $(c_base) miniperlmain.c $(mini_only_src)
obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT)
obj2 = regcomp$(OBJ_EXT) regcomp_debug$(OBJ_EXT) regcomp_invlist$(OBJ_EXT) regcomp_study$(OBJ_EXT) regcomp_trie$(OBJ_EXT)
obj3 = regexec$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro_core$(OBJ_EXT)
obj4 = keywords$(OBJ_EXT) builtin$(OBJ_EXT)
obj4 = keywords$(OBJ_EXT) builtin$(OBJ_EXT) class$(OBJ_EXT)
obj5 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT)
obj6 = scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT) peep$(OBJ_EXT)
obj7 = doop$(OBJ_EXT) doio$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT)
Expand Down
Loading

0 comments on commit 99b497a

Please sign in to comment.