compiler: check that method marked by 'enumerator MoveNext' have no required arguments. correct error message.

git-svn-id: trunk@14045 -
This commit is contained in:
paul 2009-11-04 13:33:57 +00:00
parent 2f0cde4625
commit cfa89b009f
4 changed files with 250 additions and 247 deletions

View File

@ -1207,8 +1207,8 @@ parser_e_invalid_enumerator_identifier=03259_E_Invalid enumerator identifier: "$
% Only "MoveNext" and "Current" enumerator identifiers are supported.
parser_e_enumerator_identifier_required=03260_E_Enumerator identifier required
% "MoveNext" or "Current" identifier must follow the \var{enumerator} modifier.
parser_e_enumerator_movenext_is_not_valid=03261_E_Enumerator MoveNext pattern method is not valid. Method must be a function with the Boolean return type.
% "MoveNext" enumerator pattern method must be a function with Boolean return type
parser_e_enumerator_movenext_is_not_valid=03261_E_Enumerator MoveNext pattern method is not valid. Method must be a function with the Boolean return type and no required arguments.
% "MoveNext" enumerator pattern method must be a function with Boolean return type and no required arguments
parser_e_enumerator_current_is_not_valid=03262_E_Enumerator Current pattern property is not valid. Property must have a getter.
% "Current" enumerator pattern property must have a getter
parser_e_only_one_enumerator_movenext=03263_E_Only one enumerator MoveNext method is allowed per class/object

View File

@ -810,7 +810,7 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 52737;
MsgTxtSize = 52763;
MsgIdxMax : array[1..20] of longint=(
24,87,265,91,70,50,108,22,202,62,

File diff suppressed because it is too large Load Diff

View File

@ -1300,7 +1300,9 @@ begin
begin
if oo_has_enumerator_movenext in tprocdef(pd)._class.objectoptions then
message(parser_e_only_one_enumerator_movenext);
if (pd.proctypeoption = potype_function) and is_boolean(pd.returndef) then
pd.calcparas;
if (pd.proctypeoption = potype_function) and is_boolean(pd.returndef) and
(pd.minparacount = 0) then
begin
include(tprocdef(pd)._class.objectoptions, oo_has_enumerator_movenext);
include(pd.procoptions,po_enumerator_movenext);
@ -2097,7 +2099,7 @@ const
pd_flags : [pd_interface,pd_object];
handler : @pd_enumerator;
pocall : pocall_none;
pooption : [po_enumerator_movenext];
pooption : [];
mutexclpocall : [pocall_internproc];
mutexclpotype : [];
mutexclpo : [po_exports,po_interrupt,po_external,po_inline]