3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 19:22:40 +01:00

CGrammar: Emit "Do nothing" for empty case statements

This commit is contained in:
Pragmatic Software 2014-07-18 00:39:06 +00:00
parent 7f293450ef
commit 3e47f6bc58
2 changed files with 3 additions and 1 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 738,
BUILD_REVISION => 739,
BUILD_DATE => "2014-07-17",
};

View File

@ -421,6 +421,8 @@ labeled_statement:
my $statements = join('', @{$item[-1]});
if (length $statements and $statements !~ /Exit switch block\.\s*$/) {
$statements .= "Fall through to the next case.\n";
} elsif (not length $statements and not $last) {
$statements = "Do nothing.\n";
}
$return = "If it has the value $item[-2], ^L$statements$last";
}