mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 08:10:24 +01:00
* In case no default is specified and no NoDefault is present, act as if NoDefault was given. (bug ID 10080, now we are Delphi compatible)
git-svn-id: trunk@11682 -
This commit is contained in:
parent
7a058a9bf2
commit
d2169a7e43
@ -218,6 +218,26 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
function allow_default_property(p : tpropertysym) : boolean;
|
||||
|
||||
begin
|
||||
allow_default_property:=
|
||||
(is_ordinal(p.propdef) or
|
||||
{$ifndef cpu64bitaddr}
|
||||
is_64bitint(p.propdef) or
|
||||
{$endif cpu64bitaddr}
|
||||
is_class(p.propdef) or
|
||||
is_single(p.propdef) or
|
||||
(p.propdef.typ in [classrefdef,pointerdef]) or
|
||||
is_smallset(p.propdef)
|
||||
) and not
|
||||
(
|
||||
(p.propdef.typ=arraydef) and
|
||||
(ppo_indexed in p.propoptions)
|
||||
) and not
|
||||
(ppo_hasparameters in p.propoptions);
|
||||
end;
|
||||
|
||||
var
|
||||
sym : tsym;
|
||||
p : tpropertysym;
|
||||
@ -566,20 +586,7 @@ implementation
|
||||
end;
|
||||
if try_to_consume(_DEFAULT) then
|
||||
begin
|
||||
if not(is_ordinal(p.propdef) or
|
||||
{$ifndef cpu64bitaddr}
|
||||
is_64bitint(p.propdef) or
|
||||
{$endif cpu64bitaddr}
|
||||
is_class(p.propdef) or
|
||||
is_single(p.propdef) or
|
||||
(p.propdef.typ in [classrefdef,pointerdef]) or
|
||||
is_smallset(p.propdef)
|
||||
) or
|
||||
(
|
||||
(p.propdef.typ=arraydef) and
|
||||
(ppo_indexed in p.propoptions)
|
||||
) or
|
||||
(ppo_hasparameters in p.propoptions) then
|
||||
if not allow_default_property(p) then
|
||||
begin
|
||||
Message(parser_e_property_cant_have_a_default_value);
|
||||
{ Error recovery }
|
||||
@ -619,9 +626,14 @@ implementation
|
||||
end;
|
||||
end
|
||||
else if try_to_consume(_NODEFAULT) then
|
||||
begin
|
||||
p.default:=longint($80000000);
|
||||
end
|
||||
else if allow_default_property(p) then
|
||||
begin
|
||||
p.default:=longint($80000000);
|
||||
end;
|
||||
|
||||
{ Parse possible "implements" keyword }
|
||||
if try_to_consume(_IMPLEMENTS) then
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user