diff options
author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2008-08-01 15:27:58 +0000 |
---|---|---|
committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2008-08-01 15:27:58 +0000 |
commit | b028a519a4d6dcc1da01ce8fc156fe8c7e25db50 (patch) | |
tree | 7b4fa60a2864c32535770e9d5e30cab56d355e38 /compiler | |
parent | 49a4ab7388650015b6750b076b0c6687e412d564 (diff) | |
download | fpc-b028a519a4d6dcc1da01ce8fc156fe8c7e25db50.tar.gz |
* proper support for tobject.getinterface with raw/corba interfaces, resolves #6798 and #6036
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@11497 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/defcmp.pas | 13 | ||||
-rw-r--r-- | compiler/ncnv.pas | 15 |
2 files changed, 25 insertions, 3 deletions
diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index 42626e0d83..d4a9414311 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -497,6 +497,15 @@ implementation end; end; end; + objectdef : + begin + { corba interface -> id string } + if is_interfacecorba(def_from) then + begin + doconv:=tc_intf_2_string; + eq:=te_convert_l1; + end; + end; end; end; @@ -1362,8 +1371,8 @@ implementation recorddef : begin { interface -> guid } - if is_interface(def_from) and - (def_to=rec_tguid) then + if (def_to=rec_tguid) and + (is_interfacecom(def_from) or is_dispinterface(def_from)) then begin doconv:=tc_intf_2_guid; eq:=te_convert_l1; diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 9d9437acd9..f29f6b58a2 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -74,6 +74,7 @@ interface function typecheck_arrayconstructor_to_set : tnode; function typecheck_set_to_set : tnode; function typecheck_pchar_to_string : tnode; + function typecheck_interface_to_string : tnode; function typecheck_interface_to_guid : tnode; function typecheck_dynarray_to_openarray : tnode; function typecheck_pwchar_to_string : tnode; @@ -1323,6 +1324,18 @@ implementation end; + function ttypeconvnode.typecheck_interface_to_string : tnode; + begin + if assigned(tobjectdef(left.resultdef).iidstr) then + begin + if not(oo_has_valid_guid in tobjectdef(left.resultdef).objectoptions) then + CGMessage1(type_interface_has_no_guid,tobjectdef(left.resultdef).typename); + result:=cstringconstnode.createstr(tobjectdef(left.resultdef).iidstr^); + tstringconstnode(result).changestringtype(cshortstringtype); + end; + end; + + function ttypeconvnode.typecheck_interface_to_guid : tnode; begin if assigned(tobjectdef(left.resultdef).iidguid) then @@ -1590,7 +1603,7 @@ implementation { arrayconstructor_2_set } @ttypeconvnode.typecheck_arrayconstructor_to_set, { set_to_set } @ttypeconvnode.typecheck_set_to_set, { cord_2_pointer } @ttypeconvnode.typecheck_cord_to_pointer, - { intf_2_string } nil, + { intf_2_string } @ttypeconvnode.typecheck_interface_to_string, { intf_2_guid } @ttypeconvnode.typecheck_interface_to_guid, { class_2_intf } nil, { char_2_char } @ttypeconvnode.typecheck_char_to_char, |