소스 검색

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 14 년 전
부모
커밋
8102c480d7
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  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