3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 03:02:47 +01:00

pbot-vm: rebuild without print_last_statement() if "cannot subscript something" error

This commit is contained in:
Pragmatic Software 2022-05-01 10:30:34 -07:00
parent 4b5d8aa535
commit e7f4729567
2 changed files with 10 additions and 3 deletions

View File

@ -112,7 +112,14 @@ sub postprocess {
if (not length $result) {
$self->{no_output} = 1;
} elsif ($self->{code} =~ m/print_last_statement\(.*\);$/m
&& ($result =~ m/A syntax error in expression/ || $result =~ m/No symbol.*in current context/ || $result =~ m/has unknown return type; cast the call to its declared return/ || $result =~ m/Can't take address of.*which isn't an lvalue/)) {
&& (
# should move this into its own function with a list
$result =~ m/A syntax error in expression/
|| $result =~ m/No symbol.*in current context/
|| $result =~ m/has unknown return type; cast the call to its declared return/
|| $result =~ m/Can't take address of.*which isn't an lvalue/
|| $result =~ m/cannot subscript something/
)) {
# strip print_last_statement and rebuild/re-run
$self->{code} =~ s/print_last_statement\((.*)\);/$1;/mg;
$self->preprocess;

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4533,
BUILD_DATE => "2022-04-08",
BUILD_REVISION => 4534,
BUILD_DATE => "2022-05-01",
};
sub initialize {}