The following code:
type
O = object(ParentObject)
end;
Does not generate a node for the object keyword.
Here's the fix for the first part:
procedure TPasSyntaxTreeBuilder.ObjectType; {override}
begin
FStack.Push(ntType).SetAttribute(anType, AttributeValues[atObject]);
try
inherited;
finally
MoveMembersToVisibilityNodes(FStack.Pop);
end;
end;
And the fix for the second part
procedure TmwSimplePasPar.ObjectField;
begin
if TokenID = ptSquareOpen then
CustomAttribute;
FieldNameList;
Expected(ptColon);
TypeKind;
TypeDirective;
end;
procedure TPasSyntaxTreeBuilder.ObjectField; {override}
var
Fields, Temp: TSyntaxNode;
Field, TypeInfo, TypeArgs: TSyntaxNode;
begin
Fields := TSyntaxNode.Create(ntFields);
try
FStack.Push(Fields);
try
inherited;
finally
FStack.Pop;
end;
TypeInfo := Fields.FindNode(ntType);
TypeArgs := Fields.FindNode(ntTypeArgs);
for Field in Fields.ChildNodes do
begin
if Field.Typ <> ntName then
Continue;
Temp := FStack.Push(ntField);
try
Temp.AssignPositionFrom(Field);
FStack.AddChild(Field.Clone);
TypeInfo := TypeInfo.Clone;
if Assigned(TypeArgs) then
TypeInfo.AddChild(TypeArgs.Clone);
FStack.AddChild(TypeInfo);
finally
FStack.Pop;
end;
end;
finally
Fields.Free;
end;
end;
The following code:
Does not generate a node for the
objectkeyword.Here's the fix for the first part:
And the fix for the second part