stage3/print_datatypes_error.cc
changeset 933 76324f461aed
parent 895 f824bf8e1579
child 936 0f7bcc160568
--- a/stage3/print_datatypes_error.cc	Sat Sep 27 20:09:19 2014 +0100
+++ b/stage3/print_datatypes_error.cc	Sun Sep 28 16:35:44 2014 +0100
@@ -1044,6 +1044,15 @@
 /***********************/
 /* B 3.1 - Expressions */
 /***********************/
+/* SYM_REF1(deref_expression_c, exp)  --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */
+void *print_datatypes_error_c::visit(deref_expression_c  *symbol) {
+	symbol->exp->accept(*this);
+	/* we should really check whether the expression is merely a variable. For now, leave it for the future! */
+	if ((symbol->candidate_datatypes.size() == 0) && (symbol->exp->candidate_datatypes.size() > 0))
+		STAGE3_ERROR(0, symbol, symbol, "DREF operator must be used with a value of type REF_TO.");
+	return NULL;
+}
+
 /* SYM_REF1(ref_expression_c, exp)  --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */
 void *print_datatypes_error_c::visit(  ref_expression_c  *symbol) {
 	symbol->exp->accept(*this);