towards printing of conditional values
This commit is contained in:
@@ -5,6 +5,7 @@ package body Alire.Conditional_Values is
|
||||
-----------
|
||||
|
||||
function "and" (L, R : Conditional_Value) return Conditional_Value is
|
||||
-- FIXME: we could do an effort to flatten this binary tree that's forming here in longer vectors
|
||||
begin
|
||||
return Result : Conditional_Value do
|
||||
if L.Is_Empty and then R.Is_Empty then
|
||||
@@ -57,7 +58,8 @@ package body Alire.Conditional_Values is
|
||||
end case;
|
||||
end Evaluate;
|
||||
|
||||
Empty_Value : Values;
|
||||
Empty_Value : Values with Warnings => Off;
|
||||
-- Default value should made sense; in our case it will be an empty vector...
|
||||
begin
|
||||
if This.Is_Empty then
|
||||
return Empty_Value;
|
||||
@@ -73,5 +75,19 @@ package body Alire.Conditional_Values is
|
||||
function Evaluate (This : Conditional_Value; Against : Properties.Vector) return Conditional_Value is
|
||||
(New_Value (This.Evaluate (Against)));
|
||||
|
||||
-------------
|
||||
-- Iterate --
|
||||
-------------
|
||||
|
||||
procedure Iterate_Children (This : Conditional_Value;
|
||||
Visitor : access procedure (CV : Conditional_Value))
|
||||
is
|
||||
begin
|
||||
for Inner of Vector_Inner (This.Constant_Reference.Element.all).Values loop
|
||||
case Inner.Kind is
|
||||
when others => BANG
|
||||
end case;
|
||||
end loop;
|
||||
end Iterate_Children;
|
||||
|
||||
end Alire.Conditional_Values;
|
||||
|
||||
@@ -32,10 +32,8 @@ package Alire.Conditional_Values with Preelaborate is
|
||||
|
||||
function New_Value (V : Values) return Conditional_Value; -- when we don't really need a condition
|
||||
|
||||
function Is_Value (This : Conditional_Value) return Boolean;
|
||||
|
||||
function Value (This : Conditional_Value) return Values
|
||||
with Pre => This.Is_Value;
|
||||
with Pre => This.Kind = Value;
|
||||
|
||||
---------------
|
||||
-- VECTORS --
|
||||
@@ -44,6 +42,10 @@ package Alire.Conditional_Values with Preelaborate is
|
||||
function "and" (L, R : Conditional_Value) return Conditional_Value;
|
||||
-- Concatenation
|
||||
|
||||
procedure Iterate_Children (This : Conditional_Value;
|
||||
Visitor : access procedure (CV : Conditional_Value))
|
||||
with Pre => This.Kind = Vector;
|
||||
|
||||
--------------------
|
||||
-- CONDITIONALS --
|
||||
--------------------
|
||||
@@ -137,13 +139,6 @@ private
|
||||
function Condition (This : Conditional_Value) return Requisites.Tree is
|
||||
(This.As_Conditional.Condition);
|
||||
|
||||
--------------
|
||||
-- Is_Value --
|
||||
--------------
|
||||
|
||||
function Is_Value (This : Conditional_Value) return Boolean is
|
||||
(This.Kind = Value);
|
||||
|
||||
-----------
|
||||
-- Value --
|
||||
-----------
|
||||
|
||||
Reference in New Issue
Block a user