RomanYankovsky / DelphiAST

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

`static` methodbinding is not recorded. #248

Open JBontes opened 6 years ago

JBontes commented 6 years ago
type
  r = record
    class procedure T; static;
  end;

The static method binding is not recorded.

Here's the fix:

procedure TPasSyntaxTreeBuilder.DirectiveBinding;
var
  Token: string;
begin
  token := Lexer.Token;
  // Method bindings:
  if SameText(Token, 'override') or SameText(token, 'virtual')
    or SameText(Token, 'dynamic') or SameText(Token, 'static')
  then
    FStack.Peek.Attribute[anMethodBinding]:= Token
  // Other directives
  else if SameText(token, 'reintroduce') then
    FStack.Peek.Attribute[anReintroduce]:= AttributeValues[atTrue]
  else if SameText(Token, 'overload') then
    FStack.Peek.Attribute[anOverload]:=  AttributeValues[atTrue]
  else if SameText(Token, 'abstract') or SameText(Token, 'final') then
    FStack.Peek.Attribute[anAbstract]:= Token;
  inherited;
end;