RomanYankovsky / DelphiAST

Abstract syntax tree builder for Delphi
Mozilla Public License 2.0
271 stars 116 forks source link

Labeled statement does not register #227

Open JBontes opened 6 years ago

JBontes commented 6 years ago

The following code does not register correctly:

procedure Test;
  label MyLabel;
begin
  goto MyLabel;
  MyLabel: ;     <<-- no node is created for this line.
end;

Here's the fix

procedure TPasSyntaxTreeBuilder.LabeledStatement;
var
  Temp: TSyntaxNode;
begin
  FStack.PushValuedNode(ntLabeledStatement, Lexer.Token);
  try
    inherited;
  finally
    FStack.Pop;
  end;
end;