Przeglądaj źródła

* better error position bug0269

pierre 26 lat temu
rodzic
commit
a13dba6081
4 zmienionych plików z 77 dodań i 20 usunięć
  1. 31 8
      compiler/tccal.pas
  2. 9 2
      compiler/tccnv.pas
  3. 21 6
      compiler/tcflw.pas
  4. 16 4
      compiler/tcmem.pas

+ 31 - 8
compiler/tccal.pas

@@ -237,7 +237,10 @@ implementation
                         (pfiledef(p^.left^.resulttype)^.filetype = ft_typed)
                          ) and
                      not(is_equal(p^.left^.resulttype,defcoll^.data))) then
-                       CGMessage(parser_e_call_by_ref_without_typeconv);
+                       begin
+                          aktfilepos:=p^.left^.fileinfo;
+                          CGMessage(parser_e_call_by_ref_without_typeconv);
+                       end;
                    { process cargs arrayconstructor }
                    if is_array_constructor(p^.left^.resulttype) and
                       assigned(aktcallprocsym) and
@@ -277,7 +280,10 @@ implementation
                  (defcoll^.paratyp=vs_var) and
                  not(is_open_string(defcoll^.data)) and
                  not(is_equal(p^.left^.resulttype,defcoll^.data)) then
-                 CGMessage(type_e_strict_var_string_violation);
+                 begin
+                    aktfilepos:=p^.left^.fileinfo;
+                    CGMessage(type_e_strict_var_string_violation);
+                 end;
 
               { Variablen for call by reference may not be copied }
               { into a register }
@@ -287,10 +293,16 @@ implementation
                 begin
                   if defcoll^.paratyp=vs_var then
                     if not valid_for_formal_var(p^.left) then
-                      CGMessage(parser_e_illegal_parameter_list);
+                      begin
+                         aktfilepos:=p^.left^.fileinfo;
+                         CGMessage(parser_e_illegal_parameter_list);
+                      end;
                   if defcoll^.paratyp=vs_const then
                     if not valid_for_formal_const(p^.left) then
-                      CGMessage(parser_e_illegal_parameter_list);
+                      begin
+                         aktfilepos:=p^.left^.fileinfo;
+                         CGMessage(parser_e_illegal_parameter_list);
+                      end;
                 end;
 
               if defcoll^.paratyp=vs_var then
@@ -472,7 +484,10 @@ implementation
                    pdc:=pdc^.next;
                 end;
               if assigned(pt) or assigned(pdc) then
-                CGMessage(parser_e_illegal_parameter_list);
+                begin
+                   aktfilepos:=pt^.fileinfo;
+                   CGMessage(parser_e_illegal_parameter_list);
+                end;
               { insert type conversions }
               if assigned(p^.left) then
                 begin
@@ -576,6 +591,8 @@ implementation
                       ((parsing_para_level=0) or assigned(p^.left)) and
                       (nextprocsym=nil) then
                     begin
+                       if assigned(p^.left) then
+                         aktfilepos:=p^.left^.fileinfo;
                        CGMessage(parser_e_wrong_parameter_size);
                        aktcallprocsym^.write_parameter_lists;
                        goto errorexit;
@@ -697,8 +714,11 @@ implementation
                          if (not assigned(lastparatype)) or (not assigned(pt^.resulttype)) then
                           internalerror(39393)
                          else
-                          CGMessage3(type_e_wrong_parameter_type,tostr(lastpara),
-                             pt^.resulttype^.typename,lastparatype^.typename);
+                          begin
+                             aktfilepos:=pt^.fileinfo;
+                             CGMessage3(type_e_wrong_parameter_type,tostr(lastpara),
+                               pt^.resulttype^.typename,lastparatype^.typename);
+                          end;
                           aktcallprocsym^.write_parameter_lists;
                           goto errorexit;
                        end
@@ -1172,7 +1192,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.51  1999-06-01 19:27:57  peter
+  Revision 1.51.2.1  1999-06-28 00:33:47  pierre
+   * better error position bug0269
+
+  Revision 1.51  1999/06/01 19:27:57  peter
     * better checks for procvar and methodpointer
 
   Revision 1.50  1999/06/01 14:46:00  peter

+ 9 - 2
compiler/tccnv.pas

@@ -148,6 +148,7 @@ implementation
                         pd:=p2^.resulttype;
                       if not(is_equal(pd,p2^.resulttype)) then
                        begin
+                         aktfilepos:=p2^.fileinfo;
                          CGMessage(type_e_typeconflict_in_set);
                          disposetree(p2);
                        end
@@ -161,7 +162,10 @@ implementation
                                firstpass(p3);
                              end;
                             if not(is_equal(pd,p3^.resulttype)) then
-                              CGMessage(type_e_typeconflict_in_set)
+                              begin
+                                 aktfilepos:=p3^.fileinfo;
+                                 CGMessage(type_e_typeconflict_in_set);
+                              end
                             else
                               begin
                                 if (p2^.treetype=ordconstn) and (p3^.treetype=ordconstn) then
@@ -915,7 +919,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.35.2.3  1999-06-17 12:51:48  pierre
+  Revision 1.35.2.4  1999-06-28 00:33:50  pierre
+   * better error position bug0269
+
+  Revision 1.35.2.3  1999/06/17 12:51:48  pierre
    * changed is_assignment_overloaded into
       function assignment_overloaded : pprocdef
       to allow overloading of assignment with only different result type

+ 21 - 6
compiler/tcflw.pas

@@ -77,6 +77,7 @@ implementation
          if not((p^.left^.resulttype^.deftype=orddef) and
             (porddef(p^.left^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit])) then
             begin
+               aktfilepos:=p^.left^.fileinfo;
                CGMessage(type_e_mismatch);
                exit;
             end;
@@ -255,7 +256,10 @@ implementation
 {$endif SUPPORT_MMX}
 
          if p^.left^.treetype<>assignn then
-           CGMessage(cg_e_illegal_expression);
+           begin
+              aktfilepos:=p^.left^.fileinfo;
+              CGMessage(cg_e_illegal_expression);
+           end;
 
          cleartempgen;
          must_be_valid:=false;
@@ -281,11 +285,16 @@ implementation
          while (hp^.treetype=subscriptn) do
           hp:=hp^.left;
          if (hp^.treetype<>loadn) then
-          CGMessage(cg_e_illegal_count_var)
+          begin
+             aktfilepos:=hp^.fileinfo;
+             CGMessage(cg_e_illegal_count_var)
+          end
          else
           if (not(is_ordinal(p^.t2^.resulttype))) then
-           CGMessage(type_e_ordinal_expr_expected);
-
+           begin
+              aktfilepos:=p^.t2^.fileinfo;
+              CGMessage(type_e_ordinal_expr_expected);
+           end;
          if p^.t2^.registers32>p^.registers32 then
            p^.registers32:=p^.t2^.registers32;
          if p^.t2^.registersfpu>p^.registersfpu then
@@ -384,7 +393,10 @@ implementation
               { this must be a _class_ }
               if (p^.left^.resulttype^.deftype<>objectdef) or
                 ((pobjectdef(p^.left^.resulttype)^.options and oo_is_class)=0) then
-                CGMessage(type_e_mismatch);
+                begin
+                   aktfilepos:=p^.left^.fileinfo;
+                   CGMessage(type_e_mismatch);
+                end;
 
               p^.registersfpu:=p^.left^.registersfpu;
               p^.registers32:=p^.left^.registers32;
@@ -495,7 +507,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.10.2.1  1999-06-13 22:38:54  peter
+  Revision 1.10.2.2  1999-06-28 00:33:52  pierre
+   * better error position bug0269
+
+  Revision 1.10.2.1  1999/06/13 22:38:54  peter
     * better error message when type is wrong with if statement
 
   Revision 1.10  1999/05/27 19:45:18  peter

+ 16 - 4
compiler/tcmem.pas

@@ -146,11 +146,17 @@ implementation
 
          { check the type }
          if (p^.left^.resulttype=nil) or (p^.left^.resulttype^.deftype<>pointerdef) then
-           CGMessage(type_e_pointer_type_expected);
+           begin
+              aktfilepos:=p^.left^.fileinfo;
+              CGMessage(type_e_pointer_type_expected);
+           end;
 
          if (p^.left^.location.loc<>LOC_REFERENCE) {and
             (p^.left^.location.loc<>LOC_CREGISTER)} then
-           CGMessage(cg_e_illegal_expression);
+           begin
+              aktfilepos:=p^.left^.fileinfo;
+              CGMessage(cg_e_illegal_expression);
+           end;
 
          p^.registers32:=p^.left^.registers32;
          p^.registersfpu:=p^.left^.registersfpu;
@@ -266,7 +272,10 @@ implementation
 
          { we should allow loc_mem for @string }
          if not(p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) then
-           CGMessage(cg_e_illegal_expression);
+           begin
+              aktfilepos:=p^.left^.fileinfo;
+              CGMessage(cg_e_illegal_expression);
+           end;
 
          p^.registers32:=p^.left^.registers32;
          p^.registersfpu:=p^.left^.registersfpu;
@@ -570,7 +579,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  1999-06-03 09:34:12  peter
+  Revision 1.18.2.1  1999-06-28 00:33:53  pierre
+   * better error position bug0269
+
+  Revision 1.18  1999/06/03 09:34:12  peter
     * better methodpointer check for proc->procvar
 
   Revision 1.17  1999/05/27 19:45:24  peter