proxy generator : store the call context into a local variable and use it instead of casting "self" to ICallContext, suggested by MVC ( FPC team )

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@548 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2008-09-10 16:02:05 +00:00
parent 46a16cfdd8
commit 5dac536065

View File

@@ -202,12 +202,13 @@ Const sPROXY_BASE_CLASS = 'TBaseProxy';
sRECORD_RTTI_DEFINE = 'WST_RECORD_RTTI'; sRECORD_RTTI_DEFINE = 'WST_RECORD_RTTI';
sEASY_ACCESS_INTERFACE_PREFIX = 'Easy'; sEASY_ACCESS_INTERFACE_PREFIX = 'Easy';
sPRM_NAME = 'strPrmName'; sPRM_NAME = 'locStrPrmName';
sLOC_SERIALIZER = 'locSerializer'; sLOC_SERIALIZER = 'locSerializer';
sINPUT_PARAM = 'inputParam'; sINPUT_PARAM = 'inputParam';
sOUTPUT_PARAM = 'outputParam'; sOUTPUT_PARAM = 'outputParam';
sTEMP_OBJ = 'tmpObj'; sTEMP_OBJ = 'tmpObj';
sDOCUMENTATION = 'documentation'; sDOCUMENTATION = 'documentation';
sLOC_CALL_CONTEXT = 'locCallContext';
function DeduceEasyInterfaceForDocStyle( function DeduceEasyInterfaceForDocStyle(
@@ -813,16 +814,18 @@ Var
WriteLn('Var'); WriteLn('Var');
Indent();WriteLn('%s : %s;',[sLOC_SERIALIZER,sSERIALIZER_CLASS]); Indent();WriteLn('%s : %s;',[sLOC_SERIALIZER,sSERIALIZER_CLASS]);
Indent();WriteLn('%s : ICallContext;',[sLOC_CALL_CONTEXT]);
if ( prmCnt > 0 ) or AMthd.InheritsFrom(TPasFunction) then begin if ( prmCnt > 0 ) or AMthd.InheritsFrom(TPasFunction) then begin
Indent();WriteLn('%s : %s;',[sPRM_NAME,'string']); Indent();WriteLn('%s : %s;',[sPRM_NAME,'string']);
end; end;
WriteLn('Begin'); WriteLn('Begin');
Indent();WriteLn('%s := Self as ICallContext;',[sLOC_CALL_CONTEXT]);
Indent();WriteLn('%s := GetSerializer();',[sLOC_SERIALIZER]); Indent();WriteLn('%s := GetSerializer();',[sLOC_SERIALIZER]);
Indent();WriteLn('Try');IncIndent(); Indent();WriteLn('Try');IncIndent();
Indent();WriteLn('%s.BeginCall(''%s'', GetTarget(),(Self as ICallContext));',[sLOC_SERIALIZER,SymbolTable.GetExternalName(AMthd)]); Indent();WriteLn('%s.BeginCall(''%s'', GetTarget(),%s);',[sLOC_SERIALIZER,SymbolTable.GetExternalName(AMthd),sLOC_CALL_CONTEXT]);
IncIndent(); IncIndent();
for k := 0 To Pred(prmCnt) do begin for k := 0 To Pred(prmCnt) do begin
prm := TPasArgument(prms[k]); prm := TPasArgument(prms[k]);
@@ -837,7 +840,7 @@ Var
Indent();WriteLn('MakeCall();'); Indent();WriteLn('MakeCall();');
WriteLn(''); WriteLn('');
Indent();WriteLn('%s.BeginCallRead((Self as ICallContext));',[sLOC_SERIALIZER]); Indent();WriteLn('%s.BeginCallRead(%s);',[sLOC_SERIALIZER,sLOC_CALL_CONTEXT]);
IncIndent(); IncIndent();
if AMthd.InheritsFrom(TPasFunction) then begin if AMthd.InheritsFrom(TPasFunction) then begin
resPrm := TPasFunctionType(AMthd.ProcType).ResultEl; resPrm := TPasFunctionType(AMthd.ProcType).ResultEl;