Procházet zdrojové kódy

compiler: generate an error message if enumerator operator is declared with return object which has no valid MoveNext method, Current property

git-svn-id: trunk@16806 -
paul před 14 roky
rodič
revize
8102c480d7
1 změnil soubory, kde provedl 13 přidání a 0 odebrání
  1. 13 0
      compiler/htypechk.pas

+ 13 - 0
compiler/htypechk.pas

@@ -445,6 +445,19 @@ implementation
                   begin
                     result:=
                       is_class_or_interface_or_object(pf.returndef);
+                    if result then
+                      begin
+                        if not assigned(tobjectdef(pf.returndef).search_enumerator_move) then
+                          begin
+                            Message1(sym_e_no_enumerator_move, pf.returndef.typename);
+                            result:=false;
+                          end;
+                        if not assigned(tobjectdef(pf.returndef).search_enumerator_current) then
+                          begin
+                            Message1(sym_e_no_enumerator_current,pf.returndef.typename);
+                            result:=false;
+                          end;
+                      end;
                   end
                 else
                   begin