@@ -238,6 +238,11 @@ BEGIN { $build_subclass->('', # parent
238
238
# name, map the short (PREFIX removed) name
239
239
# to the original name.
240
240
241
+ ' overload_name_seen' , # Hash of bools: indicates overload method
242
+ # names (such as '<=>') which have been
243
+ # listed by OVERLOAD (for newXS boot code
244
+ # emitting).
245
+
241
246
# Maintain the ATTRS parsing state across potentially multiple
242
247
# ATTRS keywords and or lines:
243
248
@@ -249,6 +254,17 @@ BEGIN { $build_subclass->('', # parent
249
254
250
255
' interface_macro' , # Str: value of interface extraction macro.
251
256
' interface_macro_set' , # Str: value of interface setting macro.
257
+
258
+ # PROTOTYPE value
259
+
260
+ ' prototype' , # Str: is set to either the global PROTOTYPES
261
+ # values (0 or 1), or to what's been
262
+ # overridden for this XSUB with PROTOTYPE
263
+ # "0": DISABLE
264
+ # "1": ENABLE
265
+ # "2": empty prototype
266
+ # other: a specific prototype.
267
+
252
268
)};
253
269
254
270
@@ -258,6 +274,10 @@ sub parse {
258
274
259
275
$self -> SUPER::parse($pxs ); # set file/line_no
260
276
277
+ # Initially inherit the prototype behaviour for the XSUB from the
278
+ # global PROTOTYPES default
279
+ $self -> {prototype } = $pxs -> {PROTOTYPES_value };
280
+
261
281
# Parse the XSUB's declaration (return type, name, parameters)
262
282
263
283
my $decl = ExtUtils::ParseXS::Node::xsub_decl-> new();
@@ -501,7 +521,7 @@ sub boot_code {
501
521
502
522
$proto_arg = " " ;
503
523
504
- unless ($pxs -> {xsub_prototype }) {
524
+ unless ($self -> {prototype }) {
505
525
# no prototype
506
526
$newXS = " newXS_deffile" ;
507
527
$file_arg = " " ;
@@ -511,17 +531,17 @@ sub boot_code {
511
531
$newXS = " newXSproto_portable" ;
512
532
$file_arg = " , file" ;
513
533
514
- if ($pxs -> {xsub_prototype } eq 2) {
534
+ if ($self -> {prototype } eq 2) {
515
535
# User has specified an empty prototype
516
536
}
517
- elsif ($pxs -> {xsub_prototype } eq 1) {
537
+ elsif ($self -> {prototype } eq 1) {
518
538
# Protoype enabled, but to be auto-generated by us
519
539
$proto_arg = $self -> {decl }{params }-> proto_string();
520
540
$proto_arg =~ s {\\ } { \\\\ } g ; # escape backslashes
521
541
}
522
542
else {
523
543
# User has manually specified a prototype
524
- $proto_arg = $pxs -> {xsub_prototype };
544
+ $proto_arg = $self -> {prototype };
525
545
}
526
546
527
547
$proto_arg = qq{ , "$proto_arg "} ;
608
628
# For every overload operator, generate an additional newXS()
609
629
# call to add an alias such as "Foo::(<=>" for this XSUB.
610
630
611
- for my $operator (sort keys %{ $pxs -> {xsub_map_overload_name_to_seen } })
631
+ for my $operator (sort keys %{ $pxs -> {cur_xsub }{ overload_name_seen } })
612
632
{
613
633
$pxs -> {map_overloaded_package_to_C_package }-> {$pxs -> {PACKAGE_name }}
614
634
= $pxs -> {PACKAGE_C_name };
@@ -3248,7 +3268,7 @@ BEGIN { $build_subclass->('multiline_merged', # parent
3248
3268
3249
3269
# Add all overload method names, like 'cmp', '<=>', etc, (possibly
3250
3270
# multiple ones per line) until the next keyword line, as 'seen' keys to
3251
- # the $self ->{xsub_map_overload_name_to_seen } hash.
3271
+ # the $xsub ->{overload_name_seen } hash.
3252
3272
3253
3273
sub parse {
3254
3274
my __PACKAGE__ $self = shift ;
@@ -3259,7 +3279,7 @@ sub parse {
3259
3279
my $s = $self -> {text };
3260
3280
while ($s =~ s / ^\s *([\w :"\\ )\+\-\*\/\%\<\>\.\&\|\^\!\~\{\}\= ]+)\s *// ) {
3261
3281
$self -> {ops }{$1 } = 1;
3262
- $pxs -> {xsub_map_overload_name_to_seen } -> {$1 } = 1;
3282
+ $pxs -> {cur_xsub }{ overload_name_seen } {$1 } = 1;
3263
3283
}
3264
3284
1;
3265
3285
}
@@ -3347,9 +3367,8 @@ sub parse {
3347
3367
# If no prototype specified, then assume empty prototype ""
3348
3368
$proto = 2 unless defined $proto ;
3349
3369
3350
- $self -> {prototype } = $proto ;
3351
- $pxs -> {xsub_prototype } = $proto ;
3352
-
3370
+ $self -> {prototype } = $proto ;
3371
+ $pxs -> {cur_xsub }{prototype } = $proto ;
3353
3372
3354
3373
$pxs -> {proto_behaviour_specified } = 1;
3355
3374
1;
0 commit comments