Skip to content

Commit 8dec29e

Browse files
committed
ParseXS: refactor: rm xsub_map_interface_foo field
Remove the following field from the ExtUtils::ParseXS class: xsub_map_interface_name_short_to_original and replace it with this new field in the ExtUtils::ParseXS::Node::xsub class: map_interface_name_short_to_original In addition, remove the 'map_short_orig' field from the Node::INTERFACE class - that was added by me earlier in this branch (initially unused) with the intent to become what 'map_interface_name_short_to_original' is now, but it turned out not to be suitable for this purpose, as the latter can accumulate data over multiple INTERFACE keywords.
1 parent 7559ea2 commit 8dec29e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ BEGIN {
254254
# whether that method has been listed by
255255
# OVERLOAD (for duplicate spotting).
256256

257-
'xsub_map_interface_name_short_to_original', # Hash: for each INTERFACE
258-
# name, map the short (PREFIX removed) name
259-
# to the original name.
260-
261257
'xsub_attributes', # Array of strings: all ATTRIBUTE keywords
262258
# (possibly multiple space-separated
263259
# keywords per string).
@@ -664,7 +660,6 @@ EOM
664660

665661
# Initialise more per-XSUB state
666662

667-
%{ $self->{xsub_map_interface_name_short_to_original} } = ();
668663
@{ $self->{xsub_attributes} } = (); # ATTRS: lvalue method
669664
$self->{xsub_SETMAGIC_state} = 1; # SETMAGIC: ENABLE
670665

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,12 @@ BEGIN { $build_subclass->('', # parent
232232

233233
'alias_clash_hinted', # Bool: an ALIAS warn-hint has been emitted.
234234

235+
# Maintain the INTERFACE parsing state across potentially multiple
236+
# INTERFACE keywords and or lines:
235237

238+
'map_interface_name_short_to_original', # Hash: for each INTERFACE
239+
# name, map the short (PREFIX removed) name
240+
# to the original name.
236241
)};
237242

238243

@@ -553,9 +558,9 @@ EOF
553558
# For each interface name, generate both a newXS() and
554559
# XSINTERFACE_FUNC_SET() call.
555560
foreach my $yname (sort keys
556-
%{ $pxs->{xsub_map_interface_name_short_to_original} })
561+
%{ $pxs->{cur_xsub}{map_interface_name_short_to_original} })
557562
{
558-
my $value = $pxs->{xsub_map_interface_name_short_to_original}{$yname};
563+
my $value = $pxs->{cur_xsub}{map_interface_name_short_to_original}{$yname};
559564
$yname = "$pxs->{PACKAGE_name}\::$yname" unless $yname =~ /::/;
560565
push(@code, ExtUtils::ParseXS::Q(<<"EOF"));
561566
| cv = $newXS(\"$yname\", XS_$cname$file_arg$proto_arg);
@@ -3108,7 +3113,6 @@ package ExtUtils::ParseXS::Node::INTERFACE;
31083113
# Handle INTERFACE keyword
31093114

31103115
BEGIN { $build_subclass->('multiline_merged', # parent
3111-
'map_short_orig', # hash mapping short IF names to original ones
31123116
)};
31133117

31143118

@@ -3125,10 +3129,9 @@ sub parse {
31253129
my $short = $_;
31263130
$short =~ s/^$pxs->{PREFIX_pattern}//;
31273131
$map{$short} = $_;
3128-
$pxs->{xsub_map_interface_name_short_to_original}->{$short} = $_;
3132+
$pxs->{cur_xsub}{map_interface_name_short_to_original}{$short} = $_;
31293133
}
31303134

3131-
$self->{map_short_orig} = \%map;
31323135
1;
31333136
}
31343137

0 commit comments

Comments
 (0)