Changeset 359


Ignore:
Timestamp:
Dec 23, 2014, 7:43:55 AM (6 years ago)
Author:
Maxim Reznik
Message:

Reuse interpretation index

Return the same value for each call of Get_Index with the same arg.

Location:
trunk/ada-2012/src/semantic
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ada-2012/src/semantic/gela-int-attr_functions.adb

    r358 r359  
    1212      return Attr_Function is
    1313   begin
    14       return (Length => Down'Length,
     14      return (Index  => 0,
     15              Length => Down'Length,
    1516              Kind   => Kind,
    1617              Down   => Down);
  • trunk/ada-2012/src/semantic/gela-int-defining_names.adb

    r358 r359  
    1212      return Defining_Name is
    1313   begin
    14       return (Length => Down'Length, Name => Name, Down => Down);
     14      return (Index  => 0,
     15              Length => Down'Length,
     16              Name   => Name,
     17              Down   => Down);
    1518   end Create;
    1619
  • trunk/ada-2012/src/semantic/gela-int-expressions.adb

    r358 r359  
    1212      return Expression is
    1313   begin
    14       return (Length          => Down'Length,
     14      return (Index           => 0,
     15              Length          => Down'Length,
    1516              Expression_Type => Expression_Type,
    1617              Down            => Down);
  • trunk/ada-2012/src/semantic/gela-int.ads

    r278 r359  
    66
    77   type Interpretation (Length : Natural) is abstract tagged record
    8       Down : Gela.Interpretations.Interpretation_Index_Array (1 .. Length);
     8      Index : Gela.Interpretations.Interpretation_Index;
     9      Down  : Gela.Interpretations.Interpretation_Index_Array (1 .. Length);
    910   end record;
    1011
  • trunk/ada-2012/src/semantic/gela-plian_int_sets.adb

    r357 r359  
    119119      use type Gela.Interpretations.Interpretation_Index;
    120120
     121      Item   : constant Gela.Int.Interpretation_Access :=
     122        Int_Lists.Element (Self.Pos);
    121123      Result : Gela.Interpretations.Interpretation_Index;
    122124   begin
     125      if Item.Index /= 0 then
     126         return Item.Index;
     127      end if;
     128
    123129      if Self.Set.Item_From = Self.Set.Item_To then
    124130         Self.Set.Ids.Reserve_Indexes
     
    130136      Result := Self.Set.Item_From;
    131137      Self.Set.Item_From := Self.Set.Item_From + 1;
    132       Self.Set.Int_Map.Insert (Result, Int_Lists.Element (Self.Pos));
     138      Self.Set.Int_Map.Insert (Result, Item);
     139      Item.Index := Result;
    133140
    134141      return Result;
Note: See TracChangeset for help on using the changeset viewer.