mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 19:52:34 +01:00
Improve support for C++ functions within structs/classes
This commit is contained in:
parent
1122f7ede6
commit
88f6998b12
@ -312,6 +312,10 @@ sub preprocess_code {
|
|||||||
$precode =~ s/^{(.*)}$/$1/s;
|
$precode =~ s/^{(.*)}$/$1/s;
|
||||||
|
|
||||||
if(not $has_main and not exists $self->{options}->{'-nomain'}) {
|
if(not $has_main and not exists $self->{options}->{'-nomain'}) {
|
||||||
|
if ($precode =~ s/^(};?)//) {
|
||||||
|
$self->{code} .= $1;
|
||||||
|
}
|
||||||
|
|
||||||
$self->{code} = "$prelude\n$self->{code}\n" . "int main(void) {\n$precode\n;\nreturn 0;\n}\n";
|
$self->{code} = "$prelude\n$self->{code}\n" . "int main(void) {\n$precode\n;\nreturn 0;\n}\n";
|
||||||
} else {
|
} else {
|
||||||
$self->{code} = "$prelude\n$self->{code}\n";
|
$self->{code} = "$prelude\n$self->{code}\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user