DelphiAST icon indicating copy to clipboard operation
DelphiAST copied to clipboard

`absolute` directive is not recorded

Open JBontes opened this issue 8 years ago • 0 comments

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;

JBontes avatar Oct 17 '17 10:10 JBontes