CGrammar: Improve _Static_assert translation

This commit is contained in:
Pragmatic Software 2014-07-07 08:39:06 +00:00
parent b470359071
commit d244af52d8
2 changed files with 5 additions and 2 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 => 713,
BUILD_REVISION => 714,
BUILD_DATE => "2014-07-07",
};

View File

@ -640,7 +640,10 @@ Static_assert:
static_assert_declaration:
Static_assert '(' constant_expression ',' string ')' ';'
{
$return = "Declare a static assertion to produce the diagnostic $item{string} if $item{constant_expression} is false.\n";
if(not $item{constant_expression} =~ s/ is / is not /) {
$item{constant_expression} .= ' is false';
}
$return = "Halt compilation and produce the diagnostic $item{string} if $item{constant_expression}.\n";
}
declaration_list: