@@ -216,6 +216,7 @@ TPasSyntaxTreeBuilder = class(TmwSimplePasPar)
216216 procedure PropertyParameterList ; override;
217217 procedure RaiseStatement ; override;
218218 procedure RecordConstraint ; override;
219+ procedure RecordConstant ; override;
219220 procedure RecordFieldConstant ; override;
220221 procedure RecordType ; override;
221222 procedure RecordVariant ; override;
@@ -333,7 +334,7 @@ TStringStreamHelper = class helper for TStringStream
333334// do not use const strings here to prevent allocating new strings every time
334335
335336type
336- TAttributeValue = (atAsm, atTrue, atFunction, atProcedure, atOperator, atClassOf , atClass,
337+ TAttributeValue = (atAsm, atTrue, atFunction, atProcedure, atOperator, atClass_Of , atClass,
337338 atConst, atConstructor, atDestructor, atEnum, atInterface, atNil, atNumeric,
338339 atOut, atPointer, atName, atString, atSubRange, atVar, atType{ ExplicitType} ,
339340 atObject, atSealed, atAbstract, atBegin, atOf_Object{ procedure of object} ,
@@ -984,7 +985,7 @@ procedure TPasSyntaxTreeBuilder.ClassProperty;
984985
985986procedure TPasSyntaxTreeBuilder.ClassReferenceType ;
986987begin
987- FStack.Push(ntType).Attribute [anType]:= AttributeValues[atClassof ];
988+ FStack.Push(ntType).Attribute [anType]:= AttributeValues[atClass_of ];
988989 try
989990 inherited ;
990991 finally
@@ -1143,6 +1144,15 @@ procedure TPasSyntaxTreeBuilder.ConstructorConstraint;
11431144 end ;
11441145end ;
11451146
1147+ procedure TPasSyntaxTreeBuilder.RecordConstant ;
1148+ begin
1149+ FStack.Push(ntRecordConstant);
1150+ try
1151+ inherited ;
1152+ finally
1153+ FStack.Pop;
1154+ end ;
1155+ end ;
11461156procedure TPasSyntaxTreeBuilder.RecordConstraint ;
11471157begin
11481158 FStack.Push(ntRecordConstraint);
@@ -2190,9 +2200,17 @@ procedure TPasSyntaxTreeBuilder.RecordFieldConstant;
21902200var
21912201 Node: TSyntaxNode;
21922202begin
2193- Node := FStack.PushValuedNode(ntField, Lexer.Token);
2203+ // A field in a record constant should have exactly the same layout
2204+ // as a field in a class.
2205+ // ntField (class)
2206+ // +-- ntName (anName = name)
2207+ // +-- ntType
2208+ // Recordconstant
2209+ // ntField (recordconstant)
2210+ // +-- ntName
2211+ // +-- ntExpression.
2212+ FStack.Push(ntField).AddChild(ntName).Attribute [anName]:= Lexer.Token;
21942213 try
2195- Node.Attribute [anType]:= AttributeValues[atName];
21962214 inherited ;
21972215 finally
21982216 FStack.Pop;
0 commit comments