Skip to content

Commit

Permalink
Add support for the Scale attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
thvnx committed Aug 2, 2024
1 parent b788065 commit 17eb60a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ada/nodes.lkt
Original file line number Diff line number Diff line change
Expand Up @@ -12783,7 +12783,10 @@ class AttributeRef: Name {
# Attributes that simply return subprograms
elif rel_name in s"Succ" | s"Pred" | s"Min" | s"Max" | s"Ceiling" | s"Floor" | s"Rounding" | s"Unbiased_Rounding" | s"Leading_Part" | s"Truncation" | s"Exponent" | s"Fraction" | s"Copy_Sign" | s"Remainder" | s"Adjacent" | s"Machine" | s"Machine_Rounding" | s"Scaling" | s"Compose" | s"Mod" | s"Value" | s"Wide_Value" | s"Wide_Wide_Value" | s"Fixed_Value" | s"Integer_Value" | s"Pos" | s"Val" | s"Enum_Val" | s"Write" | s"Read" | s"Output" | s"Input" | s"Put_Image" | s"Asm_Input" | s"Asm_Output" | s"Model" | s"Round" then self.attribute_subprogram_equation()
elif rel_name in s"Size" | s"VADS_Size" then self.size_equation()
elif rel_name in s"Max_Size_In_Storage_Elements" | s"Aft" | s"Object_Size" | s"Value_Size" | s"Storage_Size" then self.subtype_attr_equation()
elif rel_name in s"Max_Size_In_Storage_Elements"
| s"Aft" | s"Object_Size" | s"Value_Size" | s"Storage_Size"
| s"Scale"
then self.subtype_attr_equation()
elif rel_name in s"Access" | s"Unchecked_Access" | s"Unrestricted_Access" then self.access_equation()
elif rel_name == s"Image" then self.image_equation(node.std_string_type())
elif rel_name == s"Wide_Image" then self.image_equation(node.std_wide_string_type())
Expand Down
22 changes: 21 additions & 1 deletion testsuite/tests/name_resolution/unint_attrs/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,27 @@ Expr: <Id "Stream_Size" test_unint_attrs.adb:41:40-41:51>
type: None
expected type: None

Resolving xrefs for node <NullStmt test_unint_attrs.adb:43:7-43:12>
Resolving xrefs for node <ObjectDecl ["Y"] test_unint_attrs.adb:42:7-42:43>
***************************************************************************

Expr: <Id "Integer" test_unint_attrs.adb:42:21-42:28>
references: <DefiningName "Integer" __standard:4:8-4:15>
type: None
expected type: None
Expr: <AttributeRef test_unint_attrs.adb:42:32-42:42>
references: None
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "Volt" test_unint_attrs.adb:42:32-42:36>
references: <DefiningName "Volt" test_unint_attrs.adb:9:9-9:13>
type: None
expected type: None
Expr: <Id "Scale" test_unint_attrs.adb:42:37-42:42>
references: None
type: None
expected type: None

Resolving xrefs for node <NullStmt test_unint_attrs.adb:44:7-44:12>
*******************************************************************


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ begin
V : constant Natural := Standard'Storage_Unit;
W : constant Natural := Standard'Wchar_T_Size;
X : constant Natural := Natural'Stream_Size;
Y : constant Integer := Volt'Scale;
begin
null;
end;
Expand Down

0 comments on commit 17eb60a

Please sign in to comment.