|
@@ -782,6 +782,7 @@ type
|
|
constructor Create(const AName: string; AParent: TPasElement); override;
|
|
constructor Create(const AName: string; AParent: TPasElement); override;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
public
|
|
public
|
|
|
|
+
|
|
Labels: TFPList;
|
|
Labels: TFPList;
|
|
Body: TPasImplBlock;
|
|
Body: TPasImplBlock;
|
|
end;
|
|
end;
|
|
@@ -1010,6 +1011,7 @@ type
|
|
public
|
|
public
|
|
left : TPasExpr;
|
|
left : TPasExpr;
|
|
right : TPasExpr;
|
|
right : TPasExpr;
|
|
|
|
+ Destructor Destroy; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TPasImplSimple }
|
|
{ TPasImplSimple }
|
|
@@ -1017,6 +1019,7 @@ type
|
|
TPasImplSimple = class (TPasImplStatement)
|
|
TPasImplSimple = class (TPasImplStatement)
|
|
public
|
|
public
|
|
expr : TPasExpr;
|
|
expr : TPasExpr;
|
|
|
|
+ Destructor Destroy; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
TPasImplTryHandler = class;
|
|
TPasImplTryHandler = class;
|
|
@@ -1113,6 +1116,23 @@ implementation
|
|
|
|
|
|
uses SysUtils;
|
|
uses SysUtils;
|
|
|
|
|
|
|
|
+{ TPasImplSimple }
|
|
|
|
+
|
|
|
|
+destructor TPasImplSimple.Destroy;
|
|
|
|
+begin
|
|
|
|
+ FreeAndNil(Expr);
|
|
|
|
+ inherited Destroy;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+{ TPasImplAssign }
|
|
|
|
+
|
|
|
|
+destructor TPasImplAssign.Destroy;
|
|
|
|
+begin
|
|
|
|
+ FreeAndNil(Left);
|
|
|
|
+ FreeAndNil(Right);
|
|
|
|
+ inherited Destroy;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TPasExportSymbol }
|
|
{ TPasExportSymbol }
|
|
|
|
|
|
destructor TPasExportSymbol.Destroy;
|
|
destructor TPasExportSymbol.Destroy;
|
|
@@ -1291,13 +1311,28 @@ begin
|
|
Inc(FRefCount);
|
|
Inc(FRefCount);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{ $define debugrefcount}
|
|
|
|
+
|
|
procedure TPasElement.Release;
|
|
procedure TPasElement.Release;
|
|
|
|
|
|
|
|
+{$ifdef debugrefcount}
|
|
|
|
+Var
|
|
|
|
+ Cn : String;
|
|
|
|
+ {$endif}
|
|
|
|
+
|
|
begin
|
|
begin
|
|
|
|
+{$ifdef debugrefcount}
|
|
|
|
+ CN:=ClassName;
|
|
|
|
+ CN:=CN+' '+IntToStr(FRefCount);
|
|
|
|
+ If Assigned(Parent) then
|
|
|
|
+ CN:=CN+' ('+Parent.ClassName+')';
|
|
|
|
+ Writeln('Release : ',Cn);
|
|
|
|
+{$endif}
|
|
if FRefCount = 0 then
|
|
if FRefCount = 0 then
|
|
Free
|
|
Free
|
|
else
|
|
else
|
|
Dec(FRefCount);
|
|
Dec(FRefCount);
|
|
|
|
+{$ifdef debugrefcount} Writeln('Released : ',Cn); {$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
function TPasElement.FullName: string;
|
|
function TPasElement.FullName: string;
|
|
@@ -1784,9 +1819,15 @@ procedure TPasImplIfElse.AddElement(Element: TPasImplElement);
|
|
begin
|
|
begin
|
|
inherited AddElement(Element);
|
|
inherited AddElement(Element);
|
|
if IfBranch=nil then
|
|
if IfBranch=nil then
|
|
- IfBranch:=Element
|
|
|
|
|
|
+ begin
|
|
|
|
+ IfBranch:=Element;
|
|
|
|
+ element.AddRef;
|
|
|
|
+ end
|
|
else if ElseBranch=nil then
|
|
else if ElseBranch=nil then
|
|
- ElseBranch:=Element
|
|
|
|
|
|
+ begin
|
|
|
|
+ ElseBranch:=Element;
|
|
|
|
+ Element.AddRef;
|
|
|
|
+ end
|
|
else
|
|
else
|
|
raise Exception.Create('TPasImplIfElse.AddElement if and else already set - please report this bug');
|
|
raise Exception.Create('TPasImplIfElse.AddElement if and else already set - please report this bug');
|
|
end;
|
|
end;
|
|
@@ -2776,7 +2817,10 @@ procedure TPasImplExceptOn.AddElement(Element: TPasImplElement);
|
|
begin
|
|
begin
|
|
inherited AddElement(Element);
|
|
inherited AddElement(Element);
|
|
if Body=nil then
|
|
if Body=nil then
|
|
|
|
+ begin
|
|
Body:=Element;
|
|
Body:=Element;
|
|
|
|
+ Body.AddRef;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TPasImplStatement }
|
|
{ TPasImplStatement }
|