Hi Mathieu,
I think you picked the wrong AST type
AssignmentStatementAst is for Assignments like $x = 5 NOT for variable names!
So you only pick variables in assignments (first initial use / declaration)
To check ALL Variable Names in the AST pick this AST class instead:
System.Management.Automation.Language.ExpressionAst.VariableExpressionAst
Greets PowerPete