stage3/narrow_candidate_datatypes.hh
changeset 552 3c39d80fdede
parent 502 a6211f73690b
child 652 7fe1533d2260
--- a/stage3/narrow_candidate_datatypes.hh	Thu May 10 15:40:19 2012 +0100
+++ b/stage3/narrow_candidate_datatypes.hh	Thu May 10 16:09:50 2012 +0100
@@ -33,6 +33,27 @@
  */
 
 
+/* NOTE: The algorithm implemented here assumes that candidate datatype lists have already been filled!
+ *       BEFORE running this visitor, be sure to CALL the fill_candidate_datatype_c visitor!
+ */
+
+
+/*
+ *  Choose, from the list of all the possible datatypes each expression may take, the single datatype that it will in fact take.
+ *  The resulting (chosen) datatype, will be stored in the symbol_c.datatype variable, leaving the candidate datatype list untouched!
+ * 
+ *  For rvalue expressions, this decision will be based on the datatype of the lvalue expression.
+ *  For lvalue expressions, the candidate datatype list should have a single entry.
+ * 
+ *  For example, the very simple literal '0' in 'foo := 0', may represent a:
+ *    BOOL, BYTE, WORD, DWORD, LWORD, USINT, SINT, UINT, INT, UDINT, DINT, ULINT, LINT (as well as the SAFE versions of these data tyes too!)
+ * 
+ *  In this class, the datatype of '0' will be set to the same datatype as the 'foo' variable.
+ *  If the intersection of the candidate datatype lists of the left and right side expressions is empty, 
+ *  then a datatype error has been found, and the datatype is either left at NULL, or set to a pointer of an invalid_type_name_c object!
+ */
+
+
 #include "../absyntax_utils/absyntax_utils.hh"
 #include "datatype_functions.hh"