diff options
author | Piotr Fusik <piotr@fusion-lang.org> | 2024-02-29 15:55:25 +0100 |
---|---|---|
committer | Piotr Fusik <piotr@fusion-lang.org> | 2024-02-29 15:55:25 +0100 |
commit | ba10fe047d4e1a6d0dc13cc2a14d34bd776f2e4a (patch) | |
tree | c1e939d27d8ee478b299cb9e950aaea4670d2e7f | |
parent | 466d5d612143b5f629a69e74ff7e08974398f20d (diff) |
[c] Fix return of dynamic object initializer with pending destructions.
#140
-rw-r--r-- | GenC.fu | 1 | ||||
-rw-r--r-- | libfut.cpp | 1 | ||||
-rw-r--r-- | libfut.cs | 1 | ||||
-rw-r--r-- | libfut.js | 1 | ||||
-rw-r--r-- | test/JsonElement.fu | 4 |
5 files changed, 6 insertions, 2 deletions
@@ -2929,6 +2929,7 @@ public class GenC : GenCCpp return; } WriteCTemporaries(statement.Value); + WriteTemporaries(statement.Value); EnsureChildBlock(); StartDefinition(this.CurrentMethod.Type, true, true); Write("returnValue = "); @@ -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 = "); @@ -12105,6 +12105,7 @@ namespace Fusion return; } WriteCTemporaries(statement.Value); + WriteTemporaries(statement.Value); EnsureChildBlock(); StartDefinition(this.CurrentMethod.Type, true, true); Write("returnValue = "); @@ -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 = "); diff --git a/test/JsonElement.fu b/test/JsonElement.fu index dbc4205..5d5119c 100644 --- a/test/JsonElement.fu +++ b/test/JsonElement.fu @@ -1,4 +1,4 @@ -#if CPP || JAVA +#if C || CPP || JAVA abstract class JsonElement { public virtual bool IsObject() => false; @@ -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; |