DelphiAST
DelphiAST copied to clipboard
`absolute` directive is not recorded
var
x: integer;
y: integer absolute x;
The absolute is not recorded. and the x is recorded as if it was a value assigned to the variable.
The fix:
procedure TPasSyntaxTreeBuilder.VarAbsolute;
var
AbsoluteNode: TSyntaxNode;
ValueNode: TSyntaxNode;
begin
AbsoluteNode:= TSyntaxNode.Create(ntUnknown);
FStack.Push(AbsoluteNode);
try
inherited;
finally
FStack.Pop;
ValueNode:= AbsoluteNode.ExtractChild(AbsoluteNode.ChildNode[0]);
ValueNode.Attribute[anKind]:= AttributeValues[atAbsolute];
AbsoluteNode.Free;
FStack.Peek.AddChild(ValueNode);
end;
end;