stage3/lvalue_check.cc
changeset 846 24d0be6c31f7
parent 845 5fa872f3d073
child 926 b8538c5d0aeb
equal deleted inserted replaced
845:5fa872f3d073 846:24d0be6c31f7
   154 
   154 
   155 /*  No writing to CONSTANTs */
   155 /*  No writing to CONSTANTs */
   156 void lvalue_check_c::check_assignment_to_constant(symbol_c *lvalue) {
   156 void lvalue_check_c::check_assignment_to_constant(symbol_c *lvalue) {
   157 	unsigned int option = search_var_instance_decl->get_option(lvalue);
   157 	unsigned int option = search_var_instance_decl->get_option(lvalue);
   158 	if (option == search_var_instance_decl_c::constant_opt) {
   158 	if (option == search_var_instance_decl_c::constant_opt) {
   159 		STAGE3_ERROR(0, lvalue, lvalue, "Assignment to CONSTANT variables is not be allowed.");
   159 		STAGE3_ERROR(0, lvalue, lvalue, "Assignment to CONSTANT variables is not allowed.");
   160 	}
   160 	}
   161 }
   161 }
   162 
   162 
   163 
   163 
   164 /*  No assigning values to expressions. */
   164 /*  No assigning values to expressions. */
   228 	     (typeid( *lvalue ) == typeid( mod_expression_c               )) ||
   228 	     (typeid( *lvalue ) == typeid( mod_expression_c               )) ||
   229 	     (typeid( *lvalue ) == typeid( power_expression_c             )) ||
   229 	     (typeid( *lvalue ) == typeid( power_expression_c             )) ||
   230 	     (typeid( *lvalue ) == typeid( neg_expression_c               )) ||
   230 	     (typeid( *lvalue ) == typeid( neg_expression_c               )) ||
   231 	     (typeid( *lvalue ) == typeid( not_expression_c               )) ||
   231 	     (typeid( *lvalue ) == typeid( not_expression_c               )) ||
   232 	     (typeid( *lvalue ) == typeid( function_invocation_c          )))
   232 	     (typeid( *lvalue ) == typeid( function_invocation_c          )))
   233 		STAGE3_ERROR(0, lvalue, lvalue, "Assigning an expression to an OUT or IN_OUT parameter is not allowed.");
   233 		STAGE3_ERROR(0, lvalue, lvalue, "Assignment to an expression or a literal value is not allowed.");
   234 }                                                                  
   234 }                                                                  
   235 
   235 
   236 
   236 
   237 
   237 
   238 /*  No assigning values to IL lists. */
   238 /*  No assigning values to IL lists. */
   247 	     /****************************************/
   247 	     /****************************************/
   248 	     /***********************************/
   248 	     /***********************************/
   249 	     /* B 2.1 Instructions and Operands */
   249 	     /* B 2.1 Instructions and Operands */
   250 	     /***********************************/
   250 	     /***********************************/
   251 	     (typeid( *lvalue ) == typeid( simple_instr_list_c)))
   251 	     (typeid( *lvalue ) == typeid( simple_instr_list_c)))
   252 		STAGE3_ERROR(0, lvalue, lvalue, "Assigning an IL list IN_OUT parameter is not allowed.");
   252 		STAGE3_ERROR(0, lvalue, lvalue, "Assigning an IL list to an IN_OUT parameter is not allowed.");
   253 }                                                                  
   253 }                                                                  
   254 
   254 
   255 
   255 
   256 
   256 
   257 
   257