You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This improvement would be generally useful, not specific to my code or setup.
Engine area
Rules API
Improvement description
As said in my question issue (#257), It would be a great improvement if those two classes (ArrayTypeNode and ArrayType) could directly get the starting index, ending index and range of the array.
Now, the way of doing this is: acessing ArrayTypeNode, getting the first child of type ArrayIndicesNode, getting the first child of type SubRangeTypeNode, getting lowExpression and highExpression.
This option could make it easier to create new rules or enhance existing ones for everyone, since it simplifies the way of getting arrays indexes.
One example of usage would be a rule that verifies if a for iteration is done in the correct range. If there is an iteration in an array defined as: MyArray: array[2..5] of Integer
And the iteration something like: for Index := 2 to Length(MyArray) -1
That would not work, as the iteration would not be executed in the wanted range. With this improvement, there could be a simple way of verifying the indexes and validate if the iteration is executed the correct range.
The text was updated successfully, but these errors were encountered:
Cirras
changed the title
Option on ArrayTypeNode and ArrayType to get starting end ending array index and range
Option on ArrayTypeNode and ArrayType to get starting and ending array index and range
Jun 14, 2024
Prerequisites
Engine area
Rules API
Improvement description
As said in my question issue (#257), It would be a great improvement if those two classes (ArrayTypeNode and ArrayType) could directly get the starting index, ending index and range of the array.
Now, the way of doing this is: acessing ArrayTypeNode, getting the first child of type ArrayIndicesNode, getting the first child of type SubRangeTypeNode, getting lowExpression and highExpression.
It would be good to have something like:
Rationale
This option could make it easier to create new rules or enhance existing ones for everyone, since it simplifies the way of getting arrays indexes.
One example of usage would be a rule that verifies if a for iteration is done in the correct range. If there is an iteration in an array defined as:
MyArray: array[2..5] of Integer
And the iteration something like:
for Index := 2 to Length(MyArray) -1
That would not work, as the iteration would not be executed in the wanted range. With this improvement, there could be a simple way of verifying the indexes and validate if the iteration is executed the correct range.
The text was updated successfully, but these errors were encountered: