Skip to content

Commit 99b497a

Browse files
committed
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.
1 parent b40895a commit 99b497a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3719
-2020
lines changed

MANIFEST

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ caretx.c C file to create $^X
1818
cflags.SH A script that emits C compilation flags per file
1919
Changes Describe how to peruse changes between releases
2020
charclass_invlists.h Compiled-in inversion lists
21+
class.c Internals of the `use feature 'class'` object system
2122
CODE_OF_CONDUCT.md Information on where to find the Standards of Conduct
2223
config_h.SH Produces config.h
2324
configpm Produces lib/Config.pm
@@ -5638,6 +5639,12 @@ t/bigmem/regexp.t Test regular expressions with large strings
56385639
t/bigmem/subst.t Test s/// with large strings
56395640
t/bigmem/vec.t Check vec() handles large offsets
56405641
t/charset_tools.pl To aid in portable testing across platforms with different character sets
5642+
t/class/class.t See if class declarations work
5643+
t/class/construct.t See if class constructors work
5644+
t/class/destruct.t See if class destruction works
5645+
t/class/field.t See if class field declarations work
5646+
t/class/method.t See if class method declarations work
5647+
t/class/phasers.t See if class phaser blocks work
56415648
t/cmd/elsif.t See if else-if works
56425649
t/cmd/for.t See if for loops work
56435650
t/cmd/mod.t See if statement modifiers work
@@ -5721,6 +5728,7 @@ t/lib/common.pl Helper for lib/{warnings,feature}.t
57215728
t/lib/commonsense.t See if configuration meets basic needs
57225729
t/lib/Count.pm Helper for t/op/method.t
57235730
t/lib/croak.t Test calls to Perl_croak() in the C source.
5731+
t/lib/croak/class Test croak calls from class.c
57245732
t/lib/croak/gv Test croak calls from gv.c
57255733
t/lib/croak/mg Test croak calls from mg.c
57265734
t/lib/croak/op Test croak calls from op.c
@@ -5787,6 +5795,7 @@ t/lib/warnings/9enabled Tests warnings
57875795
t/lib/warnings/9uninit Tests "Use of uninitialized" warnings
57885796
t/lib/warnings/av Tests for av.c for warnings.t
57895797
t/lib/warnings/builtin Tests for builtin.c for warnings.t
5798+
t/lib/warnings/class Tests for class.c for warnings.t
57905799
t/lib/warnings/doio Tests for doio.c for warnings.t
57915800
t/lib/warnings/gv Tests for gv.c for warnings.t
57925801
t/lib/warnings/hv Tests for hv.c for warnings.t

Makefile.SH

+2-2
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ h = $(h1) $(h2) $(h3) $(h4) $(h5) $(h6)
538538
539539
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
540540
c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c utf8.c sv.c
541-
c3 = taint.c toke.c util.c deb.c run.c builtin.c universal.c pad.c globals.c keywords.c
541+
c3 = taint.c toke.c util.c deb.c run.c builtin.c universal.c class.c pad.c globals.c keywords.c
542542
c4 = perlio.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c dquote.c time64.c
543543
c5 = regcomp.c regcomp_debug.c regcomp_invlist.c regcomp_study.c regcomp_trie.c regexec.c
544544
c6 = $(mallocsrc)
@@ -559,7 +559,7 @@ c = $(c_base) miniperlmain.c $(mini_only_src)
559559
obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT)
560560
obj2 = regcomp$(OBJ_EXT) regcomp_debug$(OBJ_EXT) regcomp_invlist$(OBJ_EXT) regcomp_study$(OBJ_EXT) regcomp_trie$(OBJ_EXT)
561561
obj3 = regexec$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro_core$(OBJ_EXT)
562-
obj4 = keywords$(OBJ_EXT) builtin$(OBJ_EXT)
562+
obj4 = keywords$(OBJ_EXT) builtin$(OBJ_EXT) class$(OBJ_EXT)
563563
obj5 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT)
564564
obj6 = scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT) peep$(OBJ_EXT)
565565
obj7 = doop$(OBJ_EXT) doio$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT)

0 commit comments

Comments
 (0)