Skip to content

Commit 34ec182

Browse files
committed
ParseXS: refactor: tweak some code comments
Add comments about keywords which can be both inside or outside an XSUB.
1 parent 6e5771d commit 34ec182

File tree

1 file changed

+16
-1
lines changed
  • dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3007,6 +3007,11 @@ sub parse {
30073007
package ExtUtils::ParseXS::Node::EXPORT_XSUB_SYMBOLS;
30083008

30093009
# Handle EXPORT_XSUB_SYMBOLS keyword
3010+
#
3011+
# Note that this keyword can appear both inside of and outside of an
3012+
# XSUB; for the latter, it it is currently created as a temporary
3013+
# object where as_code() is called immediately after parse() and then
3014+
# the object is discarded.
30103015

30113016
BEGIN { $build_subclass->('enable', # parent
30123017
)};
@@ -3029,6 +3034,10 @@ sub as_code {
30293034

30303035
my $xs_impl = $self->{enable} ? 'XS_EXTERNAL' : 'XS_INTERNAL';
30313036

3037+
# Change the definition of XS_EUPXS, so that any subsequent
3038+
# XS_EUPXS(fXS_Foo_foo) XSUB declarations will expand to
3039+
# XS_EXTERNAL/XS_INTERNAL as appropriate
3040+
30323041
print ExtUtils::ParseXS::Q(<<"EOF");
30333042
|#undef XS_EUPXS
30343043
|#if defined(PERL_EUPXS_ALWAYS_EXPORT)
@@ -3047,6 +3056,8 @@ EOF
30473056
package ExtUtils::ParseXS::Node::PROTOTYPES;
30483057

30493058
# Handle PROTOTYPES keyword
3059+
#
3060+
# Note that this keyword can appear both inside of and outside of an XSUB.
30503061

30513062
BEGIN { $build_subclass->('enable', # parent
30523063
)};
@@ -3068,6 +3079,8 @@ sub parse {
30683079
package ExtUtils::ParseXS::Node::SCOPE;
30693080

30703081
# Handle SCOPE keyword
3082+
#
3083+
# Note that this keyword can appear both inside of and outside of an XSUB.
30713084

30723085
BEGIN { $build_subclass->('enable', # parent
30733086
)};
@@ -3087,7 +3100,7 @@ sub parse {
30873100

30883101
# Note that currently this parse method can be called either while
30893102
# parsing an XSUB, or while processing file-scoped keywords
3090-
# just before an XSUB declaration. Sop potentially set both types of
3103+
# just before an XSUB declaration. So potentially set both types of
30913104
# state.
30923105
$xsub->{SCOPE_enabled} = $self->{enable} if $xsub;
30933106
$pxs->{file_SCOPE_enabled} = $self->{enable};
@@ -3100,6 +3113,8 @@ sub parse {
31003113
package ExtUtils::ParseXS::Node::VERSIONCHECK;
31013114

31023115
# Handle VERSIONCHECK keyword
3116+
#
3117+
# Note that this keyword can appear both inside of and outside of an XSUB.
31033118

31043119
BEGIN { $build_subclass->('enable', # parent
31053120
)};

0 commit comments

Comments
 (0)