Saturday, August 24, 2013

Table Initialization – Expected Data Type

While reviewing the various To-Do entries marked in the code - words NOTE, TODO, and FIXME in comments that QtCreator highlights when the Todo plugin is enabled (Help/Plugins under Utilities) - there was a FIXME "remove" on a check in the table setup and check routine called during initialization.  This check was for an unset expression information structure for an associated code.

This check was in a loop that scans all the tables entries and for each entry that contains operands (operators or internal functions), sets the expected data type for the last operand of an operator or first operand of non-operator.  It does this by scanning the main code and all its associated codes recording the data type expected for each.  After recording all the data types, if both double and integer was found, the expected data type is set to number, or if all data types (double, integer and string) were found, the expected data type is set to any.

However, the associated codes for the sub-string functions, which are set to the related assign sub-string function codes should not be searched and therefore have the second associated code index set to -1.  The check loop was not checking for a -1 index and proceeded into the loop and should not have, so the check was added.  The check with the FIXME for an unset expression information structure was in fact necessary because some associated codes do not have this structure, specifically the input parse type codes.

While studying this code, it was discovered that the AssignList code contained associated codes for AssignListInt and AssignListStr.  This was used by the old translator routines, but not for the new translator routines because the AssignListType codes are now associated codes of the AssignType codes.  The unnecessary associated codes were removed.

[commit 07ec1e4c4f]

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)