Skip to content

Commit 6719f39

Browse files
author
Branislav Zahradník
committed
[parser] package_v544 - deduplicate coupled call sequence
Function combines call of `package` and `package_version` when new namespace statement is detected. Instead of required three statements usage now consists of single function call.
1 parent e8829bd commit 6719f39

File tree

8 files changed

+354
-346
lines changed

8 files changed

+354
-346
lines changed

embed.fnc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,6 +2486,8 @@ ARdpx |OP * |op_wrap_finally|NN OP *block \
24862486
|NN OP *finally
24872487
: Used in perly.y
24882488
p |void |package |NN OP *o
2489+
p |void |package_v544 |NN OP *o \
2490+
|NULLOK OP *v
24892491
: Used in perly.y
24902492
p |void |package_version|NN OP *v
24912493
Adp |void |packlist |NN SV *cat \

embed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,7 @@
11181118
# define oopsHV(a) Perl_oopsHV(aTHX_ a)
11191119
# define op_unscope(a) Perl_op_unscope(aTHX_ a)
11201120
# define package(a) Perl_package(aTHX_ a)
1121+
# define package_v544(a,b) Perl_package_v544(aTHX_ a,b)
11211122
# define package_version(a) Perl_package_version(aTHX_ a)
11221123
# define pad_add_weakref(a) Perl_pad_add_weakref(aTHX_ a)
11231124
# define pad_block_start(a) Perl_pad_block_start(aTHX_ a)

op.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6100,7 +6100,7 @@ Perl_newBINOP(pTHX_ I32 type, I32 flags, OP *first, OP *last)
61006100
? 2 /* Otherwise, minimum of 2 hex digits */\
61016101
: NUM_HEX_CHARS(num)))))))
61026102

6103-
/* To make evident, Configure with `-DDEBUGGING`, build, run
6103+
/* To make evident, Configure with `-DDEBUGGING`, build, run
61046104
* `./perl -Ilib -Dy t/op/tr.t`
61056105
*/
61066106
void
@@ -8243,6 +8243,27 @@ Perl_package(pTHX_ OP *o)
82438243
op_free(o);
82448244
}
82458245

8246+
/*
8247+
=for apidoc package_v544
8248+
8249+
Function combines C<package> and C<package_version>
8250+
into single call.
8251+
8252+
Available since: v5.44
8253+
8254+
=cut
8255+
*/
8256+
8257+
void
8258+
Perl_package_v544(pTHX_ OP *o, OP *v)
8259+
{
8260+
PERL_ARGS_ASSERT_PACKAGE_V544;
8261+
8262+
package (o);
8263+
if (v)
8264+
package_version (v);
8265+
}
8266+
82468267
void
82478268
Perl_package_version( pTHX_ OP *v )
82488269
{
@@ -16846,7 +16867,7 @@ Perl_subsignature_append_positional(pTHX_ PADOFFSET padix, OPCODE defmode, OP *d
1684616867
signature->next_argix++;
1684716868

1684816869
if(!padix && !defexpr)
16849-
/* This param has no var and no defaulting expression. There's
16870+
/* This param has no var and no defaulting expression. There's
1685016871
* nothing else for us to do here.
1685116872
*/
1685216873
return;

0 commit comments

Comments
 (0)