Ignore:
Timestamp:
Feb 16, 2015, 6:35:11 AM (5 years ago)
Author:
Maxim Reznik
Message:

Make distinction between index and disriminant constraint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ada-2012/src/asis/asis-extensions-flat_kinds.adb

    r398 r399  
    192192with Gela.Elements.While_Loop_Statements;
    193193with Gela.Elements.With_Clauses;
     194with Gela.Elements.Defining_Names;
     195with Gela.Type_Managers;
     196with Gela.Semantic_Types;
     197with Gela.Type_Views;
    194198
    195199package body Asis.Extensions.Flat_Kinds is
     
    12431247      Node : not null Gela.Elements.Associations.Association_Access)
    12441248   is
    1245       pragma Unreferenced (Node);
    1246    begin
    1247       Self.Result := A_Parameter_Association;
     1249      Parent : Gela.Elements.Element_Access := Node.Enclosing_Element;
     1250   begin
     1251      while Auxilary ((Data => Parent)) loop
     1252         Parent := Parent.Enclosing_Element;
     1253      end loop;
     1254
     1255      Parent.Visit (Self);
     1256
     1257      case Self.Result is
     1258         when A_Record_Aggregate =>
     1259            Self.Result := A_Record_Component_Association;
     1260         when A_Discriminant_Constraint =>
     1261            Self.Result := A_Discriminant_Association;
     1262         when others =>
     1263            Self.Result := A_Parameter_Association;
     1264      end case;
    12481265   end Association;
    12491266
     
    14331450        Composite_Constraint_Access)
    14341451   is
    1435       pragma Unreferenced (Node);
    1436    begin
    1437       Self.Result := An_Index_Constraint;  --  FIXME
     1452      use type Gela.Type_Views.Type_View_Access;
     1453
     1454      Comp : constant Gela.Compilations.Compilation_Access :=
     1455        Node.Enclosing_Compilation;
     1456
     1457      TM : constant Gela.Type_Managers.Type_Manager_Access :=
     1458        Comp.Context.Types;
     1459
     1460      Subtype_Indication : constant Gela.Elements.Subtype_Indications.
     1461        Subtype_Indication_Access :=
     1462          Gela.Elements.Subtype_Indications.Subtype_Indication_Access
     1463            (Node.Enclosing_Element);
     1464
     1465      Type_Index : constant Gela.Semantic_Types.Type_Index :=
     1466        Subtype_Indication.Type_Index;
     1467
     1468      Type_View : constant Gela.Type_Views.Type_View_Access :=
     1469        TM.Get (Type_Index);
     1470   begin
     1471      if Type_View /= null and then Type_View.Category in
     1472        Gela.Type_Views.A_String .. Gela.Type_Views.An_Other_Array
     1473      then
     1474         Self.Result := An_Index_Constraint;
     1475      else
     1476         Self.Result := A_Discriminant_Constraint;
     1477      end if;
    14381478   end Composite_Constraint;
    14391479
     
    17511791      Node : not null Gela.Elements.Identifiers.Identifier_Access)
    17521792   is
    1753       pragma Unreferenced (Node);
    1754    begin
     1793      Name : constant Gela.Elements.Defining_Names.Defining_Name_Access :=
     1794        Node.Defining_Name;
     1795   begin
     1796      if Name.Assigned then
     1797         Name.Visit (Self);
     1798
     1799         if Self.Result = A_Defining_Enumeration_Literal then
     1800            Self.Result := An_Enumeration_Literal;
     1801
     1802            return;
     1803         end if;
     1804      end if;
     1805
    17551806      Self.Result := An_Identifier;
    17561807   end Identifier;
Note: See TracChangeset for help on using the changeset viewer.