Changeset 550


Ignore:
Timestamp:
Jun 2, 2018, 7:14:25 AM (4 years ago)
Author:
Maxim Reznik
Message:

Keep package_renaming_declaration in Env

to be able expand selected names in Visible call.

Location:
trunk/ada-2012/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ada-2012/src/ag/env_out.ag

    r549 r550  
    794794           Symbol => ${Names.full_name},
    795795           Name   => Gela.Elements.Defining_Names.Defining_Name_Access (Names));
     796      ${package_renaming_declaration.env_out} :=
     797        Self.Compilation.Context.Environment_Set.Add_Rename_Package
     798          (Index  => ${package_renaming_declaration.env_out},
     799           Region => Gela.Elements.Defining_Names.Defining_Name_Access (Names),
     800           Name   => ${Renamed_Entity.Defining_Name});
    796801.)
    797802
  • trunk/ada-2012/src/ag/syntax.ag

    r547 r550  
    12831283  defining_program_unit_name <Names>
    12841284  token                      <renames_token>
    1285   name                       <Renamed_Entity>
     1285  program_unit_name          <Renamed_Entity>
    12861286  {aspect_specification}     <Aspect_Specifications>
    12871287  token                      <semicolon_token>
  • trunk/ada-2012/src/api/gela-environments.ads

    r419 r550  
    9191   --  with given Index. Return index of created environment
    9292
     93   not overriding function Add_Rename_Package
     94     (Self   : in out Environment_Set;
     95      Index  : Gela.Semantic_Types.Env_Index;
     96      Region : Gela.Elements.Defining_Names.Defining_Name_Access;
     97      Name   : Gela.Elements.Defining_Names.Defining_Name_Access)
     98      return Gela.Semantic_Types.Env_Index is abstract;
     99   --  Create new environment by adding package <Region> renames <Name> to env
     100   --  with given Index. Return index of created environment
     101
    93102   not overriding function Add_Completion
    94103     (Self       : in out Environment_Set;
  • trunk/ada-2012/src/parser/ada-lalr.ag

    r524 r550  
    30603060package_renaming_declaration ::=
    30613061  package_token defining_program_unit_name
    3062   renames_token name
     3062  renames_token program_unit_name
    30633063  [aspect_specification]
    30643064  semicolon_token
     
    30723072          -${defining_program_unit_name.ast},
    30733073          -${renames_token.ast},
    3074           -${name.ast},
     3074          -${program_unit_name.ast},
    30753075          -${aspect_specification.ast:(+Self.Factory.Aspect_Specification_Sequence)},
    30763076          -${semicolon_token.ast});
  • trunk/ada-2012/src/semantic/gela-library_environments.adb

    r419 r550  
    596596   end Add_Defining_Name;
    597597
     598   ------------------------
     599   -- Add_Rename_Package --
     600   ------------------------
     601
     602   overriding function Add_Rename_Package
     603     (Self   : in out Environment_Set;
     604      Index  : Gela.Semantic_Types.Env_Index;
     605      Region : Gela.Elements.Defining_Names.Defining_Name_Access;
     606      Name   : Gela.Elements.Defining_Names.Defining_Name_Access)
     607      return Gela.Semantic_Types.Env_Index is
     608   begin
     609      raise Program_Error;
     610      return 0;
     611   end Add_Rename_Package;
     612
    598613   ---------------------
    599614   -- Add_Use_Package --
  • trunk/ada-2012/src/semantic/gela-library_environments.ads

    r419 r550  
    6060      return Gela.Semantic_Types.Env_Index;
    6161
     62   overriding function Add_Rename_Package
     63     (Self   : in out Environment_Set;
     64      Index  : Gela.Semantic_Types.Env_Index;
     65      Region : Gela.Elements.Defining_Names.Defining_Name_Access;
     66      Name   : Gela.Elements.Defining_Names.Defining_Name_Access)
     67      return Gela.Semantic_Types.Env_Index;
     68
    6269   overriding function Add_Completion
    6370     (Self       : in out Environment_Set;
  • trunk/ada-2012/src/semantic/gela-plain_environments.adb

    r528 r550  
    429429         Reg := (Name => null,
    430430                 Local => Self.Names.Empty_List,
     431                 Rename => Self.Names.Empty_List,
    431432                 Use_Package | Completion => Defining_Name_Lists.Empty);
    432433      else
     
    466467   end Add_Defining_Name;
    467468
     469   ------------------------
     470   -- Add_Rename_Package --
     471   ------------------------
     472
     473   overriding function Add_Rename_Package
     474     (Self   : in out Environment_Set;
     475      Index  : Gela.Semantic_Types.Env_Index;
     476      Region : Gela.Elements.Defining_Names.Defining_Name_Access;
     477      Name   : Gela.Elements.Defining_Names.Defining_Name_Access)
     478      return Gela.Semantic_Types.Env_Index
     479   is
     480      Env_Index : Gela.Semantic_Types.Env_Index;
     481      Env : Env_Item;
     482      Reg : Region_Item;
     483   begin
     484      if Index in 0 | Self.Library_Level_Environment then
     485         --  Fix constraint_error because library_bodies doesn have env yet
     486         return Index;
     487      end if;
     488
     489      Env := Self.Env.Element (Index);
     490      Reg := Self.Region.Head (Env.Region_List (Nested));
     491
     492      Self.Names.Append
     493        (Symbol => Region.Full_Name,
     494         Name   => Name,
     495         Input  => Reg.Rename,
     496         Output => Reg.Rename);
     497
     498      --  Replace head of Nested_Region_List with Reg
     499      Self.Region.Prepend
     500        (Value  => Reg,
     501         Input  => Self.Region.Tail (Env.Region_List (Nested)),
     502         Output => Env.Region_List (Nested));
     503
     504      Env_Index := Self.Env.Find_Index (Env);
     505
     506      if Env_Index = 0 then
     507         Self.Env.Append (Env);
     508         Env_Index := Self.Env.Last_Index;
     509      end if;
     510
     511      return Env_Index;
     512   end Add_Rename_Package;
     513
    468514   ---------------------
    469515   -- Add_Use_Package --
     
    623669         Local       => Self.Names.Empty_List,
    624670         Use_Package => Defining_Name_Lists.Empty,
    625          Completion  => Defining_Name_Lists.Empty);
     671         Completion  => Defining_Name_Lists.Empty,
     672         Rename      => Self.Names.Empty_List);
    626673   begin
    627674      if Index in Env_Item_Index then
     
    669716         Local       => Self.Names.Empty_List,
    670717         Use_Package => Defining_Name_Lists.Empty,
    671          Completion  => Defining_Name_Lists.Empty);
     718         Completion  => Defining_Name_Lists.Empty,
     719         Rename      => Self.Names.Empty_List);
    672720   begin
    673721      if Index in Env_Item_Index then
     
    802850            if Self.Region.Head (Next).Name = Name then
    803851               return Next;
     852            elsif Name.Assigned then
     853               declare
     854                  Pos : constant Gela.Name_List_Managers.Defining_Name_Cursor
     855                    := Self.Names.Find
     856                         (Self.Region.Head (Next).Rename, Name.Full_Name);
     857               begin
     858                  if Pos.Has_Element then
     859                     return Name_To_Region (Self, Index, Pos.Element);
     860                  end if;
     861               end;
    804862            end if;
    805863
  • trunk/ada-2012/src/semantic/gela-plain_environments.ads

    r426 r550  
    3838      Completion : Defining_Name_List;
    3939      --  List of <Completion, Name> pairs
     40      Rename : Gela.Name_List_Managers.List;
     41      --  List of package renames.
    4042   end record;
    4143
     
    125127      return Gela.Semantic_Types.Env_Index;
    126128
     129   overriding function Add_Rename_Package
     130     (Self   : in out Environment_Set;
     131      Index  : Gela.Semantic_Types.Env_Index;
     132      Region : Gela.Elements.Defining_Names.Defining_Name_Access;
     133      Name   : Gela.Elements.Defining_Names.Defining_Name_Access)
     134      return Gela.Semantic_Types.Env_Index;
     135
    127136   overriding function Add_Completion
    128137     (Self       : in out Environment_Set;
Note: See TracChangeset for help on using the changeset viewer.