| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/* You may distribute under the terms of either the GNU General Public License |
|
2
|
|
|
|
|
|
|
* or the Artistic License (the same terms as Perl itself) |
|
3
|
|
|
|
|
|
|
* |
|
4
|
|
|
|
|
|
|
* (C) Paul Evans, 2021-2022 -- leonerd@leonerd.org.uk |
|
5
|
|
|
|
|
|
|
*/ |
|
6
|
|
|
|
|
|
|
#define PERL_NO_GET_CONTEXT |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
9
|
|
|
|
|
|
|
#include "perl.h" |
|
10
|
|
|
|
|
|
|
#include "XSUB.h" |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#include "object_pad.h" |
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
|
static void final_post_construct(pTHX_ FieldMeta *fieldmeta, SV *_hookdata, void *_funcdata, SV *field) |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
2
|
|
|
|
|
|
SvREADONLY_on(field); |
|
17
|
2
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
|
static void final_seal(pTHX_ FieldMeta *fieldmeta, SV *hookdata, void *_funcdata) |
|
20
|
|
|
|
|
|
|
{ |
|
21
|
2
|
100
|
|
|
|
|
if(mop_field_get_attribute(fieldmeta, "writer")) |
|
22
|
1
|
|
|
|
|
|
warn("Applying :Final attribute to field %" SVf " which already has :writer", SVfARG(mop_field_get_name(fieldmeta))); |
|
23
|
2
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
static const struct FieldHookFuncs final_hooks = { |
|
26
|
|
|
|
|
|
|
.ver = OBJECTPAD_ABIVERSION, |
|
27
|
|
|
|
|
|
|
.flags = OBJECTPAD_FLAG_ATTR_NO_VALUE, |
|
28
|
|
|
|
|
|
|
.permit_hintkey = "Object::Pad::FieldAttr::Final/Final", |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
.seal = &final_seal, |
|
31
|
|
|
|
|
|
|
.post_construct = &final_post_construct, |
|
32
|
|
|
|
|
|
|
}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
MODULE = Object::Pad::FieldAttr::Final PACKAGE = Object::Pad::FieldAttr::Final |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
BOOT: |
|
37
|
3
|
|
|
|
|
|
register_field_attribute("Final", &final_hooks, NULL); |