Parcourir la source

* don't complain in X- mode for internal generated function calls
with funcretrefnode set
* give statement error at the correct line position instead of the
block begin

peter il y a 23 ans
Parent
commit
d8495ac883
1 fichiers modifiés avec 16 ajouts et 4 suppressions
  1. 16 4
      compiler/nbas.pas

+ 16 - 4
compiler/nbas.pas

@@ -265,7 +265,10 @@ implementation
          if (not (cs_extsyntax in aktmoduleswitches)) and
             assigned(right.resulttype.def) and
             not((right.nodetype=calln) and
-                (tcallnode(right).procdefinition.proctypeoption=potype_constructor)) and
+                { don't complain when funcretrefnode is set, because then the
+                  value is already used. And also not for constructors }
+                (assigned(tcallnode(right).funcretrefnode) or
+                 (tcallnode(right).procdefinition.proctypeoption=potype_constructor))) and
             not(is_void(right.resulttype.def)) then
            CGMessage(cg_e_illegal_expression);
          if codegenerror then
@@ -351,9 +354,12 @@ implementation
                    if (not (cs_extsyntax in aktmoduleswitches)) and
                       assigned(hp.right.resulttype.def) and
                       not((hp.right.nodetype=calln) and
-                          (tcallnode(hp.right).procdefinition.proctypeoption=potype_constructor)) and
+                          { don't complain when funcretrefnode is set, because then the
+                            value is already used. And also not for constructors }
+                          (assigned(tcallnode(hp.right).funcretrefnode) or
+                           (tcallnode(hp.right).procdefinition.proctypeoption=potype_constructor))) and
                       not(is_void(hp.right.resulttype.def)) then
-                     CGMessage(cg_e_illegal_expression);
+                     CGMessagePos(hp.right.fileinfo,cg_e_illegal_expression);
                    { the resulttype of the block is the last type that is
                      returned. Normally this is a voidtype. But when the
                      compiler inserts a block of multiple statements then the
@@ -761,7 +767,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.35  2002-09-01 08:01:16  daniel
+  Revision 1.36  2002-10-05 15:15:19  peter
+    * don't complain in X- mode for internal generated function calls
+      with funcretrefnode set
+    * give statement error at the correct line position instead of the
+      block begin
+
+  Revision 1.35  2002/09/01 08:01:16  daniel
    * Removed sets from Tcallnode.det_resulttype
    + Added read/write notifications of variables. These will be usefull
      for providing information for several optimizations. For example