summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-08-09 19:19:36 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-08-09 19:19:36 +0200
commitdbcc7a573200a57600fa550c75201791903c4535 (patch)
tree391ac24f2626c62d2573b538a9c707c99bca89d8 /src
parent37e48fb6ece2a3d6fae7dee9588c191fe040d054 (diff)
Found some worrisome issue there.
The (index_of ...) in collections.fate yield changing values.
Diffstat (limited to 'src')
-rw-r--r--src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java
index ae89702..2731e78 100644
--- a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java
+++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java
@@ -18,6 +18,7 @@ import tonkadur.wyrd.v1.lang.instruction.SetValue;
import tonkadur.wyrd.v1.compiler.util.BinarySearch;
import tonkadur.wyrd.v1.compiler.util.IfElse;
+import tonkadur.wyrd.v1.compiler.util.If;
import tonkadur.wyrd.v1.compiler.util.IterativeSearch;
import tonkadur.wyrd.v1.compiler.util.CountOccurrences;
@@ -1115,9 +1116,9 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor
n.get_collection().get_visited_by(cc);
- result_as_computation = new Size(cc.get_ref());
+ assimilate(cc);
- cc.release_variables();
+ result_as_computation = new Size(cc.get_ref());
}
@Override
@@ -1127,7 +1128,36 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor
)
throws Throwable
{
- /* TODO */
+ final ComputationCompiler elem_cc, collection_cc;
+ final Ref result, result_found;
+
+ result = reserve(Type.INT);
+ result_found = reserve(Type.BOOLEAN);
+
+ elem_cc = new ComputationCompiler(compiler);
+ collection_cc = new ComputationCompiler(compiler);
+
+ n.get_element().get_visited_by(elem_cc);
+ n.get_collection().get_visited_by(collection_cc);
+
+ assimilate(elem_cc);
+ assimilate(collection_cc);
+
+ init_instructions.add
+ (
+ IterativeSearch.generate
+ (
+ compiler.anonymous_variables(),
+ compiler.assembler(),
+ elem_cc.get_computation(),
+ new Size(collection_cc.get_ref()),
+ collection_cc.get_ref(),
+ result_found,
+ result
+ )
+ );
+
+ result_as_ref = result;
}
@Override