/** <!--******************************************************************--> * * @fn CHKMassign * * @brief Touched the node and its sons/attributes * * @param arg_node Assign node to process * @param arg_info pointer to info structure * * @return processed node * ***************************************************************************/ node * CHKMassign (node * arg_node, info * arg_info) { DBUG_ENTER ("CHKMassign"); NODE_ERROR (arg_node) = CHKMTRAV (NODE_ERROR (arg_node), arg_info); ASSIGN_LET (arg_node) = CHKMTRAV (ASSIGN_LET (arg_node), arg_info); ASSIGN_EXPR (arg_node) = CHKMTRAV (ASSIGN_EXPR (arg_node), arg_info); DBUG_RETURN (arg_node); }
/** <!--******************************************************************--> * * @fn COPYassign * * @brief Copies the node and its sons/attributes * * @param arg_node Assign node to process * @param arg_info pointer to info structure * * @return processed node * ***************************************************************************/ node * COPYassign (node * arg_node, info * arg_info) { node *result = TBmakeAssign (NULL, NULL); DBUG_ENTER ("COPYassign"); LUTinsertIntoLutP (INFO_LUT (arg_info), arg_node, result); /* Copy sons */ ASSIGN_LET (result) = COPYTRAV (ASSIGN_LET (arg_node), arg_info); ASSIGN_EXPR (result) = COPYTRAV (ASSIGN_EXPR (arg_node), arg_info); /* Return value */ DBUG_RETURN (result); }
//check type assign node *CTassign(node *arg_node, info *arg_info){ DBUG_ENTER("CTassign"); //compare varlet type with assignent expression type ASSIGN_LET(arg_node) = TRAVdo(ASSIGN_LET(arg_node), arg_info); type vartype = INFO_TYPE(arg_info); ASSIGN_EXPR(arg_node) = TRAVdo(ASSIGN_EXPR(arg_node), arg_info); type exprtype = INFO_TYPE(arg_info); if(vartype != exprtype){ CTIerrorLine(NODE_LINE(arg_node), "The expression type of the assign does not match the variable type"); } DBUG_RETURN(arg_node); }
node * PRTassign (node * arg_node, info * arg_info) { DBUG_ENTER ("PRTassign"); if (ASSIGN_LET( arg_node) != NULL) { ASSIGN_LET( arg_node) = TRAVdo( ASSIGN_LET( arg_node), arg_info); printf( " = "); } ASSIGN_EXPR( arg_node) = TRAVdo( ASSIGN_EXPR( arg_node), arg_info); printf( ";\n"); DBUG_RETURN (arg_node); }