You've already forked lazarus-ccr
easy access interface should be handle only in the unit containing the original interface.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1318 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -315,11 +315,24 @@ var
|
||||
g : TGuid;
|
||||
e : TPasElement;
|
||||
procCount : Integer;
|
||||
locName : string;
|
||||
begin
|
||||
if ( ARawInt.ObjKind <> okInterface ) then
|
||||
raise Exception.CreateFmt('Interface expected : "%s".',[ARawInt.Name]);
|
||||
locName := Format('%s%s',[ARawInt.Name,sEASY_ACCESS_INTERFACE_PREFIX]);
|
||||
e := AContainer.FindElement(locName);
|
||||
if (e <> nil) then begin
|
||||
Result := e as TPasClassType;
|
||||
Exit;
|
||||
end;
|
||||
procCount := 0;
|
||||
locRes := TPasClassType(AContainer.CreateElement(TPasClassType,Format('%s%s',[ARawInt.Name,sEASY_ACCESS_INTERFACE_PREFIX]),nil,'',0));
|
||||
locRes := TPasClassType(
|
||||
AContainer.CreateElement(
|
||||
TPasClassType,
|
||||
Format('%s%s',[ARawInt.Name,sEASY_ACCESS_INTERFACE_PREFIX]),
|
||||
AContainer.CurrentModule.InterfaceSection,'',0
|
||||
)
|
||||
);
|
||||
try
|
||||
locRes.ObjKind := okInterface;
|
||||
if ( CreateGUID(g) = 0 ) then
|
||||
@ -437,8 +450,14 @@ begin
|
||||
intf := elt as TPasClassType;
|
||||
binding := SymbolTable.FindBinding(intf);
|
||||
intfEasy := nil;
|
||||
if ( binding.BindingStyle = bsDocument ) then
|
||||
intfEasy := DeduceEasyInterfaceForDocStyle(intf,SymbolTable);
|
||||
if ( binding.BindingStyle = bsDocument ) then begin
|
||||
if (binding.EasyIntf = nil) then begin
|
||||
binding.EasyIntf := DeduceEasyInterfaceForDocStyle(intf,SymbolTable);
|
||||
if (binding.EasyIntf <> nil) then
|
||||
binding.EasyIntf.Release();
|
||||
end;
|
||||
intfEasy := binding.EasyIntf;
|
||||
end;
|
||||
GenerateProxyIntf(intf,intfEasy,binding);
|
||||
GenerateProxyImp(intf,intfEasy,binding);
|
||||
end;
|
||||
@ -3118,15 +3137,16 @@ begin
|
||||
if ( c > 0 ) then begin
|
||||
for i := 0 to ( c - 1 ) do begin
|
||||
locBinding := FSymbolTable.Binding[i];
|
||||
if ( locBinding.BindingStyle = bsDocument ) then begin
|
||||
clssTyp := DeduceEasyInterfaceForDocStyle(locBinding.Intf,FSymbolTable);
|
||||
if ( clssTyp <> nil ) then begin
|
||||
try
|
||||
GenerateIntf(clssTyp);
|
||||
finally
|
||||
clssTyp.Release();
|
||||
end;
|
||||
if (typeList.IndexOf(locBinding.Intf) >= 0) and
|
||||
(locBinding.BindingStyle = bsDocument)
|
||||
then begin
|
||||
if (locBinding.EasyIntf = nil) then begin
|
||||
locBinding.EasyIntf := DeduceEasyInterfaceForDocStyle(locBinding.Intf,FSymbolTable);
|
||||
if (locBinding.EasyIntf <> nil) then
|
||||
locBinding.EasyIntf.Release();
|
||||
end;
|
||||
if ( locBinding.EasyIntf <> nil ) then
|
||||
GenerateIntf(locBinding.EasyIntf);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -56,9 +56,12 @@ type
|
||||
|
||||
TwstBinding = class(TPasElement)
|
||||
private
|
||||
FEasyIntf : TPasClassType;
|
||||
FAddress: string;
|
||||
FBindingStyle: TBindingStyle;
|
||||
FIntf: TPasClassType;
|
||||
private
|
||||
procedure setEasyIntf(const AValue : TPasClassType);
|
||||
public
|
||||
constructor Create(
|
||||
const AName : string;
|
||||
@ -67,6 +70,7 @@ type
|
||||
);reintroduce;
|
||||
destructor Destroy();override;
|
||||
property Intf : TPasClassType read FIntf;
|
||||
property EasyIntf : TPasClassType read FEasyIntf write setEasyIntf;
|
||||
property Address : string read FAddress write FAddress;
|
||||
property BindingStyle : TBindingStyle read FBindingStyle write FBindingStyle;
|
||||
end;
|
||||
@ -1027,6 +1031,17 @@ end;
|
||||
|
||||
{ TwstBinding }
|
||||
|
||||
procedure TwstBinding.setEasyIntf(const AValue : TPasClassType);
|
||||
begin
|
||||
if (FEasyIntf = AValue) then
|
||||
exit;
|
||||
if (FEasyIntf <> nil) then
|
||||
FEasyIntf.Release();
|
||||
FEasyIntf := AValue;
|
||||
if (FEasyIntf <> nil) then
|
||||
FEasyIntf.AddRef();
|
||||
end;
|
||||
|
||||
constructor TwstBinding.Create(
|
||||
const AName : string;
|
||||
AIntf : TPasClassType;
|
||||
@ -1045,6 +1060,10 @@ begin
|
||||
FIntf.Release();
|
||||
FIntf := nil;
|
||||
end;
|
||||
if Assigned(FEasyIntf) then begin
|
||||
FEasyIntf.Release();
|
||||
FEasyIntf := nil;
|
||||
end;
|
||||
inherited Destroy();
|
||||
end;
|
||||
|
||||
|
@ -831,6 +831,7 @@ var
|
||||
locStrBuffer : string;
|
||||
locIsRefElement : Boolean;
|
||||
locTypeHint : string;
|
||||
locTypeAddRef : Boolean;
|
||||
begin
|
||||
locType := nil;
|
||||
locTypeName := '';
|
||||
@ -839,6 +840,7 @@ var
|
||||
locPartCursor := CreateCursorOn(locAttCursor.Clone() as IObjectCursor,ParseFilter(Format('%s = %s',[s_NODE_NAME,QuotedStr(s_name)]),TDOMNodeRttiExposer));
|
||||
locPartCursor.Reset();
|
||||
locIsRefElement := False;
|
||||
locTypeAddRef := True;
|
||||
if not locPartCursor.MoveNext() then begin
|
||||
locPartCursor := CreateCursorOn(locAttCursor.Clone() as IObjectCursor,ParseFilter(Format('%s = %s',[s_NODE_NAME,QuotedStr(s_ref)]),TDOMNodeRttiExposer));
|
||||
locPartCursor.Reset();
|
||||
@ -892,9 +894,10 @@ var
|
||||
if IsReservedKeyWord(locTypeInternalName) then begin
|
||||
locTypeInternalName := '_' + locTypeInternalName;
|
||||
end;
|
||||
locType := TPasUnresolvedTypeRef(FSymbols.CreateElement(TPasUnresolvedTypeRef,locTypeInternalName,Self.Module.InterfaceSection,visDefault,'',0));
|
||||
Self.Module.InterfaceSection.Declarations.Add(locType);
|
||||
Self.Module.InterfaceSection.Types.Add(locType);
|
||||
locType := TPasUnresolvedTypeRef(FSymbols.CreateElement(TPasUnresolvedTypeRef,locTypeInternalName,nil{Self.Module.InterfaceSection},visDefault,'',0));
|
||||
locTypeAddRef := False;
|
||||
//Self.Module.InterfaceSection.Declarations.Add(locType);
|
||||
//Self.Module.InterfaceSection.Types.Add(locType);
|
||||
if not AnsiSameText(locTypeInternalName,locTypeName) then
|
||||
FSymbols.RegisterExternalAlias(locType,locTypeName);
|
||||
end;
|
||||
@ -907,7 +910,8 @@ var
|
||||
locProp := TPasProperty(FSymbols.CreateElement(TPasProperty,locInternalEltName,classDef,visPublished,'',0));
|
||||
classDef.Members.Add(locProp);
|
||||
locProp.VarType := locType as TPasType;
|
||||
locType.AddRef();
|
||||
if locTypeAddRef then
|
||||
locType.AddRef();
|
||||
if locHasInternalName then
|
||||
FSymbols.RegisterExternalAlias(locProp,locName);
|
||||
{if AnsiSameText(locType.Name,locProp.Name) then begin
|
||||
|
Reference in New Issue
Block a user