Skip to content

Commit

Permalink
[c] Fix return of dynamic object initializer with pending destructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
pfusik committed Feb 29, 2024
1 parent 466d5d6 commit ba10fe0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions GenC.fu
Original file line number Diff line number Diff line change
Expand Up @@ -2929,6 +2929,7 @@ public class GenC : GenCCpp
return;
}
WriteCTemporaries(statement.Value);
WriteTemporaries(statement.Value);
EnsureChildBlock();
StartDefinition(this.CurrentMethod.Type, true, true);
Write("returnValue = ");
Expand Down
1 change: 1 addition & 0 deletions libfut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11836,6 +11836,7 @@ void GenC::visitReturn(const FuReturn * statement)
return;
}
writeCTemporaries(statement->value.get());
writeTemporaries(statement->value.get());
ensureChildBlock();
startDefinition(this->currentMethod->type.get(), true, true);
write("returnValue = ");
Expand Down
1 change: 1 addition & 0 deletions libfut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12105,6 +12105,7 @@ internal override void VisitReturn(FuReturn statement)
return;
}
WriteCTemporaries(statement.Value);
WriteTemporaries(statement.Value);
EnsureChildBlock();
StartDefinition(this.CurrentMethod.Type, true, true);
Write("returnValue = ");
Expand Down
1 change: 1 addition & 0 deletions libfut.js
Original file line number Diff line number Diff line change
Expand Up @@ -12505,6 +12505,7 @@ export class GenC extends GenCCpp
return;
}
this.#writeCTemporaries(statement.value);
this.writeTemporaries(statement.value);
this.ensureChildBlock();
this.#startDefinition(this.currentMethod.type, true, true);
this.write("returnValue = ");
Expand Down
4 changes: 2 additions & 2 deletions test/JsonElement.fu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if CPP || JAVA
#if C || CPP || JAVA
abstract class JsonElement
{
public virtual bool IsObject() => false;
Expand Down Expand Up @@ -352,7 +352,7 @@ public static class Test
{
public static bool Run()
{
JsonElement# json; //FAIL: c TODO; cl
JsonElement# json; //FAIL: cl
json = JsonElement.Parse("\"foo\"");
if (!json.IsString() || json.GetString() != "foo")
return false;
Expand Down

0 comments on commit ba10fe0

Please sign in to comment.