Skip to content

Commit

Permalink
Changed TExpressionMethod to a procedure of object. Anonymous mehtods…
Browse files Browse the repository at this point in the history
… are not supported with FPC. And it's also dangerous to use them with Delphi. They tend to leak memory caused by a compiler bug (https://quality.embarcadero.com/browse/AP-120)
  • Loading branch information
Wosi committed May 14, 2015
1 parent f7b03fb commit a4ce30e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Source/DelphiAST.pas
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TNodeStack = class

TPasSyntaxTreeBuilder = class(TmwSimplePasPar)
private type
TExpressionMethod = reference to procedure;
TExpressionMethod = procedure of object;
private
procedure BuildExpressionTree(ExpressionMethod: TExpressionMethod);
procedure ParserMessage(Sender: TObject; const Typ: TMessageEventType; const Msg: string; X, Y: Integer);
Expand Down Expand Up @@ -641,12 +641,11 @@ procedure TPasSyntaxTreeBuilder.ConstantDeclaration;
end;

procedure TPasSyntaxTreeBuilder.ConstantExpression;
var
ExpressionMethod: TExpressionMethod;
begin
BuildExpressionTree(
procedure
begin
inherited ConstantExpression;
end);
ExpressionMethod := inherited ConstantExpression;
BuildExpressionTree(ExpressionMethod);
end;

procedure TPasSyntaxTreeBuilder.ConstantName;
Expand Down Expand Up @@ -858,12 +857,11 @@ procedure TPasSyntaxTreeBuilder.ExportsElement;
end;

procedure TPasSyntaxTreeBuilder.Expression;
var
ExpressionMethod: TExpressionMethod;
begin
BuildExpressionTree(
procedure
begin
inherited Expression
end);
ExpressionMethod := inherited Expression;
BuildExpressionTree(ExpressionMethod);
end;

procedure TPasSyntaxTreeBuilder.ExpressionList;
Expand Down

0 comments on commit a4ce30e

Please sign in to comment.