aboutsummaryrefslogtreecommitdiff
path: root/src/kompsos.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/kompsos.adb')
-rw-r--r--src/kompsos.adb35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/kompsos.adb b/src/kompsos.adb
index 2efa69b..97e8ce6 100644
--- a/src/kompsos.adb
+++ b/src/kompsos.adb
@@ -252,10 +252,12 @@ package body Kompsos is
Ptr : State_Component_Access := This.Ctrl.Actual;
begin
while Ptr /= null loop
- if Ptr.Key = Key then
- Value := Term'Class (Ptr.Value);
- return True;
- end if;
+ for Index in Valid_Count range Valid_Count'First .. Ptr.Valid loop
+ if Ptr.Data (Index).Key = Key then
+ Value := Term'Class (Ptr.Data (Index).Value);
+ return True;
+ end if;
+ end loop;
Ptr := Ptr.Next.Ctrl.Actual;
end loop;
return False;
@@ -608,20 +610,23 @@ package body Kompsos is
begin
if Subst.Ctrl.Actual = null then
return Empty_Term;
- else
- declare
- Min_Pos : State_Component_Access := Subst.Ctrl.Actual;
- Marker : State_Component_Access := Min_Pos.Next.Ctrl.Actual;
- begin
- while Marker /= null loop
- if Marker.Key < Min_Pos.Key then
+ end if;
+ declare
+ Min_Pos : State_Component_Access := Subst.Ctrl.Actual;
+ Min_Ind : Valid_Count := Valid_Count'First;
+ Marker : State_Component_Access := Min_Pos;
+ begin
+ while Marker /= null loop
+ for Index in Valid_Count range Valid_Count'First .. Marker.Valid loop
+ if Marker.Data (Index).Key < Min_Pos.Data (Min_Ind).Key then
Min_Pos := Marker;
+ Min_Ind := Index;
end if;
- Marker := Marker.Next.Ctrl.Actual;
end loop;
- return Min_Pos.Value.Resolve (Subst);
- end;
- end if;
+ Marker := Marker.Next.Ctrl.Actual;
+ end loop;
+ return Min_Pos.Data (Min_Ind).Value.Resolve (Subst);
+ end;
end Resolve_First;