mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 20:01:27 +02:00
* enable parsing of default properties when used with objects, resolves #10795
git-svn-id: trunk@11003 -
This commit is contained in:
parent
4ad8ccf05c
commit
d7673694f1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8191,6 +8191,7 @@ tests/webtbs/tw10757.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw10768.pp svneol=native#text/plain
|
tests/webtbs/tw10768.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw10790.pp svneol=native#text/plain
|
tests/webtbs/tw10790.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw10791.pp svneol=native#text/plain
|
tests/webtbs/tw10791.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw10795.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw10800.pp svneol=native#text/plain
|
tests/webtbs/tw10800.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw10807.pp svneol=native#text/plain
|
tests/webtbs/tw10807.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1081.pp svneol=native#text/plain
|
tests/webtbs/tw1081.pp svneol=native#text/plain
|
||||||
|
@ -1836,7 +1836,7 @@ implementation
|
|||||||
|
|
||||||
_LECKKLAMMER:
|
_LECKKLAMMER:
|
||||||
begin
|
begin
|
||||||
if is_class_or_interface(p1.resultdef) then
|
if is_class_or_interface_or_object(p1.resultdef) then
|
||||||
begin
|
begin
|
||||||
{ default property }
|
{ default property }
|
||||||
protsym:=search_default_property(tobjectdef(p1.resultdef));
|
protsym:=search_default_property(tobjectdef(p1.resultdef));
|
||||||
|
@ -673,6 +673,7 @@ interface
|
|||||||
function is_class(def: tdef): boolean;
|
function is_class(def: tdef): boolean;
|
||||||
function is_cppclass(def: tdef): boolean;
|
function is_cppclass(def: tdef): boolean;
|
||||||
function is_class_or_interface(def: tdef): boolean;
|
function is_class_or_interface(def: tdef): boolean;
|
||||||
|
function is_class_or_interface_or_object(def: tdef): boolean;
|
||||||
function is_class_or_interface_or_dispinterface(def: tdef): boolean;
|
function is_class_or_interface_or_dispinterface(def: tdef): boolean;
|
||||||
|
|
||||||
|
|
||||||
@ -4369,6 +4370,7 @@ implementation
|
|||||||
(tobjectdef(def).objecttype=odt_class);
|
(tobjectdef(def).objecttype=odt_class);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function is_object(def: tdef): boolean;
|
function is_object(def: tdef): boolean;
|
||||||
begin
|
begin
|
||||||
is_object:=
|
is_object:=
|
||||||
@ -4377,6 +4379,7 @@ implementation
|
|||||||
(tobjectdef(def).objecttype=odt_object);
|
(tobjectdef(def).objecttype=odt_object);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function is_cppclass(def: tdef): boolean;
|
function is_cppclass(def: tdef): boolean;
|
||||||
begin
|
begin
|
||||||
is_cppclass:=
|
is_cppclass:=
|
||||||
@ -4385,15 +4388,25 @@ implementation
|
|||||||
(tobjectdef(def).objecttype=odt_cppclass);
|
(tobjectdef(def).objecttype=odt_cppclass);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function is_class_or_interface(def: tdef): boolean;
|
function is_class_or_interface(def: tdef): boolean;
|
||||||
begin
|
begin
|
||||||
is_class_or_interface:=
|
result:=
|
||||||
assigned(def) and
|
assigned(def) and
|
||||||
(def.typ=objectdef) and
|
(def.typ=objectdef) and
|
||||||
(tobjectdef(def).objecttype in [odt_class,odt_interfacecom,odt_interfacecorba]);
|
(tobjectdef(def).objecttype in [odt_class,odt_interfacecom,odt_interfacecorba]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function is_class_or_interface_or_object(def: tdef): boolean;
|
||||||
|
begin
|
||||||
|
result:=
|
||||||
|
assigned(def) and
|
||||||
|
(def.typ=objectdef) and
|
||||||
|
(tobjectdef(def).objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_object]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function is_class_or_interface_or_dispinterface(def: tdef): boolean;
|
function is_class_or_interface_or_dispinterface(def: tdef): boolean;
|
||||||
begin
|
begin
|
||||||
result:=
|
result:=
|
||||||
|
18
tests/webtbs/tw10795.pp
Normal file
18
tests/webtbs/tw10795.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
type
|
||||||
|
TObj = object
|
||||||
|
function GetItem(const i :Integer) :Integer;
|
||||||
|
property Items[i :Integer] :Integer read GetItem; default;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TObj.GetItem(const i :Integer) :Integer;
|
||||||
|
begin
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Obj :TObj;
|
||||||
|
|
||||||
|
begin
|
||||||
|
WriteLn(Obj[0],' ',Obj[10]);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user