From 5dac5360651a645cf90af30387df3af6fc2b0da6 Mon Sep 17 00:00:00 2001 From: inoussa Date: Wed, 10 Sep 2008 16:02:05 +0000 Subject: [PATCH] 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 --- wst/trunk/ws_helper/generator.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wst/trunk/ws_helper/generator.pas b/wst/trunk/ws_helper/generator.pas index 188169e78..8db3d2ce1 100644 --- a/wst/trunk/ws_helper/generator.pas +++ b/wst/trunk/ws_helper/generator.pas @@ -202,12 +202,13 @@ Const sPROXY_BASE_CLASS = 'TBaseProxy'; sRECORD_RTTI_DEFINE = 'WST_RECORD_RTTI'; sEASY_ACCESS_INTERFACE_PREFIX = 'Easy'; - sPRM_NAME = 'strPrmName'; + sPRM_NAME = 'locStrPrmName'; sLOC_SERIALIZER = 'locSerializer'; sINPUT_PARAM = 'inputParam'; sOUTPUT_PARAM = 'outputParam'; sTEMP_OBJ = 'tmpObj'; sDOCUMENTATION = 'documentation'; + sLOC_CALL_CONTEXT = 'locCallContext'; function DeduceEasyInterfaceForDocStyle( @@ -813,16 +814,18 @@ Var WriteLn('Var'); Indent();WriteLn('%s : %s;',[sLOC_SERIALIZER,sSERIALIZER_CLASS]); + Indent();WriteLn('%s : ICallContext;',[sLOC_CALL_CONTEXT]); if ( prmCnt > 0 ) or AMthd.InheritsFrom(TPasFunction) then begin Indent();WriteLn('%s : %s;',[sPRM_NAME,'string']); end; WriteLn('Begin'); + Indent();WriteLn('%s := Self as ICallContext;',[sLOC_CALL_CONTEXT]); Indent();WriteLn('%s := GetSerializer();',[sLOC_SERIALIZER]); 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(); for k := 0 To Pred(prmCnt) do begin prm := TPasArgument(prms[k]); @@ -837,7 +840,7 @@ Var Indent();WriteLn('MakeCall();'); WriteLn(''); - Indent();WriteLn('%s.BeginCallRead((Self as ICallContext));',[sLOC_SERIALIZER]); + Indent();WriteLn('%s.BeginCallRead(%s);',[sLOC_SERIALIZER,sLOC_CALL_CONTEXT]); IncIndent(); if AMthd.InheritsFrom(TPasFunction) then begin resPrm := TPasFunctionType(AMthd.ProcType).ResultEl;