You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the parsing of an XSUB's signature, and the parsing of
the individual comma-separated items within that signature, are done in
the same function, Params->parse(). This commit is the first of three
which will extract out the latter into a separate Param->parse() method.
For now, the per-param code is kept in-place (to make the diff easier to
understand), but is wrapped within an immediately-called anon sub, in
preparation to be moved.
So before, the code was (very simplified):
for (split /,/, $params_text) {
... parse type, name, init etc ...
next if can't parse;
my $param = Param->new(var = $var, type => $type, ...);
push @{$params->{kids}}, $param;
}
After this commit, it looks more like:
for (split /,/, $params_text) {
my $param = Param->new();
sub {
my $param = shift;
...
... parse type, name, init etc ...
return if can't parse;
$param->{var} = $var; ...
return 1;
}->{$param, ...)
or next;
push @{$params->{kids}}, $param;
}
Note that the inner sub leaves pushing the new param, updating the names
hash and setting the arg_num to the caller.
In theory there are no functional changes, except that when a synthetic
RETVAL is being kept (but its position within kids moved), we now keep
the Param hash and update its contents, rather than replace it with a new
hash. This shouldn't make any difference.
0 commit comments