Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions class.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,30 @@ Perl_class_add_ADJUST(pTHX_ HV *stash, CV *cv)
av_push(aux->xhv_class_adjust_blocks, (SV *)cv);
}

OP *
Perl_ck_classname(pTHX_ OP *o)
{
if(!CvIsMETHOD(PL_compcv))
croak("Cannot use __CLASS__ outside of a method or field initializer expression");
Comment on lines +1065 to +1066
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon my ignorance 😃 I think ADJUST is currently considered a method, but eventually will become a phaser. It is intended that __CLASS__ will work there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah definitely. The ADJUST blocks will become individual blocks that are all still part of one overall containing method, so __CLASS__ still still work fine there. It'll just stop being one method per block.


return o;
}

PP(pp_classname)
{
dSP;
dTARGET;

SV *self = PAD_SVl(PADIX_SELF);
assert(SvTYPE(SvRV(self)) == SVt_PVOBJ);

EXTEND(SP, 1);
PUSHs(TARG);
sv_ref(TARG, SvRV(self), true);

RETURN;
}

/*
* ex: set ts=8 sts=4 sw=4 et:
*/
57 changes: 29 additions & 28 deletions embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -1155,35 +1155,12 @@
# if defined(PERL_IN_AV_C)
# define get_aux_mg(a) S_get_aux_mg(aTHX_ a)
# endif
# if defined(PERL_IN_DEB_C)
# define deb_stack_n(a,b,c,d,e) S_deb_stack_n(aTHX_ a,b,c,d,e)
# endif
# if defined(PERL_IN_DOIO_C)
# define argvout_final(a,b,c) S_argvout_final(aTHX_ a,b,c)
# define exec_failed(a,b,c) S_exec_failed(aTHX_ a,b,c)
# define ingroup(a,b) S_ingroup(aTHX_ a,b)
# define is_fork_open S_is_fork_open
# define openn_cleanup(a,b,c,d,e,f,g,h,i,j,k,l,m) S_openn_cleanup(aTHX_ a,b,c,d,e,f,g,h,i,j,k,l,m)
# define openn_setup(a,b,c,d,e,f) S_openn_setup(aTHX_ a,b,c,d,e,f)
# endif
# if defined(PERL_IN_DOOP_C)
# define do_trans_complex(a,b) S_do_trans_complex(aTHX_ a,b)
# define do_trans_count(a,b) S_do_trans_count(aTHX_ a,b)
# define do_trans_count_invmap(a,b) S_do_trans_count_invmap(aTHX_ a,b)
# define do_trans_invmap(a,b) S_do_trans_invmap(aTHX_ a,b)
# define do_trans_simple(a,b) S_do_trans_simple(aTHX_ a,b)
# endif
# if defined(PERL_IN_DUMP_C)
# define deb_curcv(a) S_deb_curcv(aTHX_ a)
# define debprof(a) S_debprof(aTHX_ a)
# define pm_description(a) S_pm_description(aTHX_ a)
# define sequence_num(a) S_sequence_num(aTHX_ a)
# endif
# if defined(PERL_IN_GLOBALS_C) || defined(PERL_IN_OP_C) || \
defined(PERL_IN_PEEP_C)
# if defined(PERL_IN_CLASS_C) || defined(PERL_IN_GLOBALS_C) || \
defined(PERL_IN_OP_C) || defined(PERL_IN_PEEP_C)
# define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a)
# define ck_backtick(a) Perl_ck_backtick(aTHX_ a)
# define ck_bitop(a) Perl_ck_bitop(aTHX_ a)
# define ck_classname(a) Perl_ck_classname(aTHX_ a)
# define ck_cmp(a) Perl_ck_cmp(aTHX_ a)
# define ck_concat(a) Perl_ck_concat(aTHX_ a)
# define ck_defined(a) Perl_ck_defined(aTHX_ a)
Expand Down Expand Up @@ -1230,8 +1207,32 @@
# define ck_tell(a) Perl_ck_tell(aTHX_ a)
# define ck_trunc(a) Perl_ck_trunc(aTHX_ a)
# define ck_trycatch(a) Perl_ck_trycatch(aTHX_ a)
# endif /* defined(PERL_IN_GLOBALS_C) || defined(PERL_IN_OP_C) ||
defined(PERL_IN_PEEP_C) */
# endif /* defined(PERL_IN_CLASS_C) || defined(PERL_IN_GLOBALS_C) ||
defined(PERL_IN_OP_C) || defined(PERL_IN_PEEP_C) */
# if defined(PERL_IN_DEB_C)
# define deb_stack_n(a,b,c,d,e) S_deb_stack_n(aTHX_ a,b,c,d,e)
# endif
# if defined(PERL_IN_DOIO_C)
# define argvout_final(a,b,c) S_argvout_final(aTHX_ a,b,c)
# define exec_failed(a,b,c) S_exec_failed(aTHX_ a,b,c)
# define ingroup(a,b) S_ingroup(aTHX_ a,b)
# define is_fork_open S_is_fork_open
# define openn_cleanup(a,b,c,d,e,f,g,h,i,j,k,l,m) S_openn_cleanup(aTHX_ a,b,c,d,e,f,g,h,i,j,k,l,m)
# define openn_setup(a,b,c,d,e,f) S_openn_setup(aTHX_ a,b,c,d,e,f)
# endif
# if defined(PERL_IN_DOOP_C)
# define do_trans_complex(a,b) S_do_trans_complex(aTHX_ a,b)
# define do_trans_count(a,b) S_do_trans_count(aTHX_ a,b)
# define do_trans_count_invmap(a,b) S_do_trans_count_invmap(aTHX_ a,b)
# define do_trans_invmap(a,b) S_do_trans_invmap(aTHX_ a,b)
# define do_trans_simple(a,b) S_do_trans_simple(aTHX_ a,b)
# endif
# if defined(PERL_IN_DUMP_C)
# define deb_curcv(a) S_deb_curcv(aTHX_ a)
# define debprof(a) S_debprof(aTHX_ a)
# define pm_description(a) S_pm_description(aTHX_ a)
# define sequence_num(a) S_sequence_num(aTHX_ a)
# endif
# if defined(PERL_IN_GV_C)
# define find_default_stash(a,b,c,d,e,f) S_find_default_stash(aTHX_ a,b,c,d,e,f)
# define gv_fetchmeth_internal(a,b,c,d,e,f) S_gv_fetchmeth_internal(aTHX_ a,b,c,d,e,f)
Expand Down
4 changes: 2 additions & 2 deletions ext/Opcode/Opcode.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Opcode 1.64;
package Opcode 1.65;

use strict;

Expand Down Expand Up @@ -567,7 +567,7 @@ This tag holds opcodes related to loading modules and getting information
about calling environment and args.

require dofile
caller runcv
caller runcv classname

=item :still_to_be_decided

Expand Down
4 changes: 2 additions & 2 deletions ext/Pod-Functions/t/Functions.t
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ Keywords related to Perl modules:
do, import, no, package, require, use

Keywords related to classes and object-orientation:
bless, class, dbmclose, dbmopen, field, method, package,
ref, tie, tied, untie, use
__CLASS__, bless, class, dbmclose, dbmopen, field, method,
package, ref, tie, tied, untie, use

Low-level socket functions:
accept, bind, connect, getpeername, getsockname,
Expand Down
23 changes: 19 additions & 4 deletions keywords.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading