[fpc-pascal] Exploring block statements with CodeTools not working

Hairy Pixels genericptr at gmail.com
Sun Oct 16 04:19:56 CEST 2022


I’m trying to look at the code in a the begin..end section of this sample program but for some reason when it gets to the BeginBlock node child count is always 0 (other nodes are as expected though). I’m calling Explore correctly I think so what could the problem be?

Here is the little test program I’m using along with a snippet which explores the code and walks the tree.

Btw, I understand this question is basically for Mattias but I don’t know where else to post. Does Mattias prefer I post in one of these forums https://forum.lazarus.freepascal.org or maybe email privately with code tools questions?

========================

  program test;

  var
    A: Integer;
  begin
    A := 1;
  end.

========================

CodeToolBoss.Explore(Code, Tool, true);

Node := tool.Tree.Root;
while Node <> nil do
  begin    
    writeln(Node.DescAsString, ‘ -> ’, Node.ChildCount);
    Node := Node.Next;
  end;

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list