From 31d35f5781ab731f4713b943e99bf58f2f413a0f Mon Sep 17 00:00:00 2001 From: nsensfel Date: Tue, 15 Sep 2020 18:18:05 +0200 Subject: Starting to fix Reference -> Computation on computations. I want to be able to write `(reverse (range 0 50 5))`, but `reverse` and the others all take references as input. --- data/tests/extra_functionals.fate | 3 ++ .../lang/computation/AddElementsOfComputation.java | 18 +++++----- .../v1/lang/computation/FilterComputation.java | 10 +++--- .../tonkadur/fate/v1/lang/computation/Fold.java | 12 +++---- .../v1/lang/computation/IndexedMapComputation.java | 10 +++--- .../fate/v1/lang/computation/MapComputation.java | 10 +++--- .../fate/v1/lang/computation/MergeComputation.java | 18 +++++----- .../v1/lang/computation/PartitionComputation.java | 10 +++--- .../computation/RemoveAllOfElementComputation.java | 10 +++--- .../computation/RemoveElementAtComputation.java | 10 +++--- .../lang/computation/RemoveElementComputation.java | 3 +- .../v1/lang/computation/SetFieldsComputation.java | 8 ++--- .../fate/v1/lang/computation/SortComputation.java | 10 +++--- .../v1/lang/computation/SubListComputation.java | 10 +++--- .../v1/compiler/fate/v1/ComputationCompiler.java | 42 ++++++++++++++++++++-- 15 files changed, 112 insertions(+), 72 deletions(-) diff --git a/data/tests/extra_functionals.fate b/data/tests/extra_functionals.fate index 1c06597..9fcb171 100644 --- a/data/tests/extra_functionals.fate +++ b/data/tests/extra_functionals.fate @@ -70,4 +70,7 @@ (= (var int_list_a) (remove_at 4 int_list_c)) (set int_list_c (range 0 20 2)) +(set int_list_a (var int_list_c)) +(reverse! int_list_a) +;;(set int_list_b (reverse (range 0 50 5))) (end) diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java index b9d4468..907768e 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java @@ -7,7 +7,7 @@ import tonkadur.fate.v1.lang.type.CollectionType; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class AddElementsOfComputation extends Computation @@ -15,8 +15,8 @@ public class AddElementsOfComputation extends Computation /***************************************************************************/ /**** MEMBERS **************************************************************/ /***************************************************************************/ - protected final Reference other_collection; - protected final Reference collection; + protected final Computation other_collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -25,8 +25,8 @@ public class AddElementsOfComputation extends Computation protected AddElementsOfComputation ( final Origin origin, - final Reference other_collection, - final Reference collection + final Computation other_collection, + final Computation collection ) { super(origin, collection.get_type()); @@ -42,8 +42,8 @@ public class AddElementsOfComputation extends Computation public static AddElementsOfComputation build ( final Origin origin, - final Reference other_collection, - final Reference collection + final Computation other_collection, + final Computation collection ) throws ParsingError { @@ -67,12 +67,12 @@ public class AddElementsOfComputation extends Computation cv.visit_add_elements_of(this); } - public Reference get_source_collection () + public Computation get_source_collection () { return other_collection; } - public Reference get_target_collection () + public Computation get_target_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/FilterComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/FilterComputation.java index 4926265..9fdb63f 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/FilterComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/FilterComputation.java @@ -10,7 +10,7 @@ import tonkadur.fate.v1.lang.type.CollectionType; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class FilterComputation extends Computation @@ -19,7 +19,7 @@ public class FilterComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation lambda_function; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -29,7 +29,7 @@ public class FilterComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection + final Computation collection ) { super(origin, collection.get_type()); @@ -46,7 +46,7 @@ public class FilterComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection + final Computation collection ) throws ParsingError { @@ -77,7 +77,7 @@ public class FilterComputation extends Computation return lambda_function; } - public Reference get_collection () + public Computation get_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/Fold.java b/src/core/src/tonkadur/fate/v1/lang/computation/Fold.java index 293036c..2be97d1 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/Fold.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/Fold.java @@ -12,7 +12,7 @@ import tonkadur.fate.v1.lang.type.CollectionType; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class Fold extends Computation @@ -22,7 +22,7 @@ public class Fold extends Computation /***************************************************************************/ protected final Computation lambda_function; protected final Computation initial_value; - protected final Reference collection; + protected final Computation collection; protected final boolean is_foldl; /***************************************************************************/ @@ -34,7 +34,7 @@ public class Fold extends Computation final Origin origin, final Computation lambda_function, final Computation initial_value, - final Reference collection, + final Computation collection, final boolean is_foldl, final Type act_as ) @@ -56,7 +56,7 @@ public class Fold extends Computation final Origin origin, final Computation lambda_function, final Computation initial_value, - final Reference collection, + final Computation collection, final boolean is_foldl ) throws ParsingError @@ -110,7 +110,7 @@ public class Fold extends Computation return initial_value; } - public Reference get_collection () + public Computation get_collection () { return collection; } @@ -140,7 +140,7 @@ public class Fold extends Computation sb.append(" "); sb.append(initial_value.toString()); sb.append(" "); - sb.append(collection.get_name()); + sb.append(collection.toString()); sb.append(")"); return sb.toString(); diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/IndexedMapComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/IndexedMapComputation.java index d134b71..7190582 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/IndexedMapComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/IndexedMapComputation.java @@ -12,7 +12,7 @@ import tonkadur.fate.v1.lang.type.CollectionType; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class IndexedMapComputation extends Computation @@ -21,7 +21,7 @@ public class IndexedMapComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation lambda_function; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -31,7 +31,7 @@ public class IndexedMapComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection, + final Computation collection, final Type output_type ) { @@ -49,7 +49,7 @@ public class IndexedMapComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection + final Computation collection ) throws Throwable { @@ -96,7 +96,7 @@ public class IndexedMapComputation extends Computation return lambda_function; } - public Reference get_collection () + public Computation get_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java index 4cbd2a7..394dd9a 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java @@ -11,7 +11,7 @@ import tonkadur.fate.v1.lang.type.CollectionType; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class MapComputation extends Computation @@ -20,7 +20,7 @@ public class MapComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation lambda_function; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -30,7 +30,7 @@ public class MapComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection, + final Computation collection, final Type output_type ) { @@ -47,7 +47,7 @@ public class MapComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection + final Computation collection ) throws ParsingError { @@ -90,7 +90,7 @@ public class MapComputation extends Computation return lambda_function; } - public Reference get_collection () + public Computation get_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/MergeComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/MergeComputation.java index a4b41b6..e961729 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/MergeComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/MergeComputation.java @@ -14,7 +14,7 @@ import tonkadur.fate.v1.lang.instruction.Merge; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class MergeComputation extends Computation @@ -23,9 +23,9 @@ public class MergeComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation lambda_function; - protected final Reference collection_in_a; + protected final Computation collection_in_a; protected final Computation default_a; - protected final Reference collection_in_b; + protected final Computation collection_in_b; protected final Computation default_b; protected final boolean to_set; @@ -37,9 +37,9 @@ public class MergeComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection_in_a, + final Computation collection_in_a, final Computation default_a, - final Reference collection_in_b, + final Computation collection_in_b, final Computation default_b, final boolean to_set, final Type output_type @@ -63,9 +63,9 @@ public class MergeComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection_in_a, + final Computation collection_in_a, final Computation default_a, - final Reference collection_in_b, + final Computation collection_in_b, final Computation default_b, final boolean to_set ) @@ -138,7 +138,7 @@ public class MergeComputation extends Computation return lambda_function; } - public Reference get_collection_in_a () + public Computation get_collection_in_a () { return collection_in_a; } @@ -148,7 +148,7 @@ public class MergeComputation extends Computation return default_a; } - public Reference get_collection_in_b () + public Computation get_collection_in_b () { return collection_in_b; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/PartitionComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/PartitionComputation.java index a30a893..75bc3d6 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/PartitionComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/PartitionComputation.java @@ -11,7 +11,7 @@ import tonkadur.fate.v1.lang.type.Type; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class PartitionComputation extends Computation @@ -20,7 +20,7 @@ public class PartitionComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation lambda_function; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -30,7 +30,7 @@ public class PartitionComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection, + final Computation collection, final Type output_type ) { @@ -48,7 +48,7 @@ public class PartitionComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection + final Computation collection ) throws Throwable { @@ -98,7 +98,7 @@ public class PartitionComputation extends Computation return lambda_function; } - public Reference get_collection () + public Computation get_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java index 6220875..a3fd529 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java @@ -5,7 +5,7 @@ import tonkadur.parser.ParsingError; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class RemoveAllOfElementComputation extends Computation @@ -14,7 +14,7 @@ public class RemoveAllOfElementComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation element; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -24,7 +24,7 @@ public class RemoveAllOfElementComputation extends Computation ( final Origin origin, final Computation element, - final Reference collection + final Computation collection ) { super(origin, collection.get_type()); @@ -40,7 +40,7 @@ public class RemoveAllOfElementComputation extends Computation ( final Origin origin, final Computation element, - final Reference collection + final Computation collection ) throws ParsingError { @@ -62,7 +62,7 @@ public class RemoveAllOfElementComputation extends Computation return element; } - public Reference get_collection () + public Computation get_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java index 837af0e..4863992 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java @@ -7,7 +7,7 @@ import tonkadur.fate.v1.lang.type.Type; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class RemoveElementAtComputation extends Computation @@ -16,7 +16,7 @@ public class RemoveElementAtComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation index; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -26,7 +26,7 @@ public class RemoveElementAtComputation extends Computation ( final Origin origin, final Computation index, - final Reference collection + final Computation collection ) { super(origin, collection.get_type()); @@ -43,7 +43,7 @@ public class RemoveElementAtComputation extends Computation ( final Origin origin, final Computation index, - final Reference collection + final Computation collection ) throws ParsingError { @@ -66,7 +66,7 @@ public class RemoveElementAtComputation extends Computation return index; } - public Reference get_collection () + public Computation get_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java index cb9c275..a484de3 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java @@ -5,7 +5,6 @@ import tonkadur.parser.ParsingError; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class RemoveElementComputation extends Computation @@ -40,7 +39,7 @@ public class RemoveElementComputation extends Computation ( final Origin origin, final Computation element, - final Reference collection + final Computation collection ) throws ParsingError { diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/SetFieldsComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/SetFieldsComputation.java index d9c66f6..84ca06e 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/SetFieldsComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/SetFieldsComputation.java @@ -7,7 +7,7 @@ import tonkadur.parser.Origin; import tonkadur.functional.Cons; import tonkadur.fate.v1.lang.meta.ComputationVisitor; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.Computation; public class SetFieldsComputation extends Computation @@ -15,7 +15,7 @@ public class SetFieldsComputation extends Computation /***************************************************************************/ /**** MEMBERS **************************************************************/ /***************************************************************************/ - protected final Reference target; + protected final Computation target; protected final List> field_assignments; /***************************************************************************/ @@ -29,7 +29,7 @@ public class SetFieldsComputation extends Computation public SetFieldsComputation ( final Origin origin, - final Reference target, + final Computation target, final List> field_assignments ) { @@ -47,7 +47,7 @@ public class SetFieldsComputation extends Computation cv.visit_set_fields(this); } - public Reference get_target () + public Computation get_target () { return target; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/SortComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/SortComputation.java index 7131c8b..7127920 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/SortComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/SortComputation.java @@ -13,7 +13,7 @@ import tonkadur.fate.v1.lang.instruction.Sort; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class SortComputation extends Computation @@ -22,7 +22,7 @@ public class SortComputation extends Computation /**** MEMBERS **************************************************************/ /***************************************************************************/ protected final Computation lambda_function; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -32,7 +32,7 @@ public class SortComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection + final Computation collection ) { super(origin, collection.get_type()); @@ -49,7 +49,7 @@ public class SortComputation extends Computation ( final Origin origin, final Computation lambda_function, - final Reference collection + final Computation collection ) throws ParsingError { @@ -85,7 +85,7 @@ public class SortComputation extends Computation return lambda_function; } - public Reference get_collection () + public Computation get_collection () { return collection; } diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/SubListComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/SubListComputation.java index 38ba1d9..23304b1 100644 --- a/src/core/src/tonkadur/fate/v1/lang/computation/SubListComputation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/SubListComputation.java @@ -7,7 +7,7 @@ import tonkadur.fate.v1.lang.type.Type; import tonkadur.fate.v1.lang.meta.ComputationVisitor; import tonkadur.fate.v1.lang.meta.Computation; -import tonkadur.fate.v1.lang.meta.Reference; +import tonkadur.fate.v1.lang.meta.Computation; import tonkadur.fate.v1.lang.meta.RecurrentChecks; public class SubListComputation extends Computation @@ -17,7 +17,7 @@ public class SubListComputation extends Computation /***************************************************************************/ protected final Computation start; protected final Computation end; - protected final Reference collection; + protected final Computation collection; /***************************************************************************/ /**** PROTECTED ************************************************************/ @@ -28,7 +28,7 @@ public class SubListComputation extends Computation final Origin origin, final Computation start, final Computation end, - final Reference collection + final Computation collection ) { super(origin, collection.get_type()); @@ -47,7 +47,7 @@ public class SubListComputation extends Computation final Origin origin, final Computation start, final Computation end, - final Reference collection + final Computation collection ) throws ParsingError { @@ -66,7 +66,7 @@ public class SubListComputation extends Computation cv.visit_sublist(this); } - public Reference get_collection () + public Computation get_collection () { return collection; } 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 db5b8f9..74489f8 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 @@ -30,6 +30,7 @@ import tonkadur.wyrd.v1.compiler.util.RemoveAt; import tonkadur.wyrd.v1.compiler.util.InsertAt; import tonkadur.wyrd.v1.compiler.util.RemoveAllOf; import tonkadur.wyrd.v1.compiler.util.RemoveOneOf; +import tonkadur.wyrd.v1.compiler.util.ReverseList; import tonkadur.wyrd.v1.compiler.util.CreateCons; import tonkadur.wyrd.v1.compiler.util.IterativeSearch; import tonkadur.wyrd.v1.compiler.util.CountOccurrences; @@ -2127,7 +2128,12 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor ); new_element_addr = - new RelativeAddress(result_as_address, iterator.get_value(), Type.INT); + new RelativeAddress + ( + result_as_address, + new Cast(iterator.get_value(), Type.STRING), + Type.INT + ); while_body.add(new Initialize(new_element_addr)); while_body.add @@ -2351,7 +2357,39 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor ) throws Throwable { - /* TODO */ + final ComputationCompiler address_compiler; + final Register result; + + result = reserve(TypeCompiler.compile(compiler, n.get_type())); + result_as_address = result.get_address(); + result_as_computation = result.get_value(); + + address_compiler = new ComputationCompiler(compiler); + + n.get_collection().get_visited_by(address_compiler); + + if (address_compiler.has_init()) + { + init_instructions.add(address_compiler.get_init()); + } + + init_instructions.add + ( + new SetValue(result_as_address, address_compiler.get_computation()) + ); + + address_compiler.release_registers(init_instructions); + + init_instructions.add + ( + ReverseList.generate + ( + compiler.registers(), + compiler.assembler(), + new Size(result_as_address), + result_as_address + ) + ); } @Override -- cgit v1.2.3-70-g09d2