Commit 6eefd524 authored by Juergen Nickelsen's avatar Juergen Nickelsen

fix: omit type check for defaulted optional arguments

parent 8931e361
......@@ -22,7 +22,7 @@ BEGIN {
}
# check arguments; descriptor is string "xxx:xx" with mandatory args
# before the :, then# optional args; x is:
# before the :, then optional args; x is:
# e: any expression
# y: symbol
# p: pair
......@@ -39,7 +39,7 @@ sub checkargs {
my $argno = 0;
my $optional = 0;
for my $desc (split('', $descriptor)) {
#warn("checkargs: arglist ", &$Princs($arglist));
#warn("checkargs: desc $desc; arglist ", &$Princs($arglist));
if ($desc eq 'R') {
#warn("checkargs: set $desc to ", &$Princs($arglist));
push(@result, list2array($arglist));
......@@ -51,6 +51,7 @@ sub checkargs {
last;
}
if ($desc eq ':') {
#warn("checkargs: see :optional");
$optional = 1;
next;
}
......@@ -59,13 +60,18 @@ sub checkargs {
unless $optional || consp($arglist);
my $arg;
($arg, $arglist) = cxr($arglist);
#warn("\$arg: ", Dumper($arg));
my $optional_defaulted = 0;
if (defined($arg)) {
$argno++;
} else {
$arg = $Nil;
$optional_defaulted = 1;
}
if ($desc eq 'e') {
; # this is relatively frequent
if ($desc eq 'e' || $optional_defaulted) {
; # this is relatively frequent, and we do
# not need to check the argument type
# any more
} elsif ($desc eq 'S') {
$arg = &$Princs($arg);
} elsif ($desc eq 'y') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment