@@ -216,6 +216,7 @@ TPasSyntaxTreeBuilder = class(TmwSimplePasPar)
216
216
procedure PropertyParameterList ; override;
217
217
procedure RaiseStatement ; override;
218
218
procedure RecordConstraint ; override;
219
+ procedure RecordConstant ; override;
219
220
procedure RecordFieldConstant ; override;
220
221
procedure RecordType ; override;
221
222
procedure RecordVariant ; override;
@@ -333,7 +334,7 @@ TStringStreamHelper = class helper for TStringStream
333
334
// do not use const strings here to prevent allocating new strings every time
334
335
335
336
type
336
- TAttributeValue = (atAsm, atTrue, atFunction, atProcedure, atOperator, atClassOf , atClass,
337
+ TAttributeValue = (atAsm, atTrue, atFunction, atProcedure, atOperator, atClass_Of , atClass,
337
338
atConst, atConstructor, atDestructor, atEnum, atInterface, atNil, atNumeric,
338
339
atOut, atPointer, atName, atString, atSubRange, atVar, atType{ ExplicitType} ,
339
340
atObject, atSealed, atAbstract, atBegin, atOf_Object{ procedure of object} ,
@@ -984,7 +985,7 @@ procedure TPasSyntaxTreeBuilder.ClassProperty;
984
985
985
986
procedure TPasSyntaxTreeBuilder.ClassReferenceType ;
986
987
begin
987
- FStack.Push(ntType).Attribute [anType]:= AttributeValues[atClassof ];
988
+ FStack.Push(ntType).Attribute [anType]:= AttributeValues[atClass_of ];
988
989
try
989
990
inherited ;
990
991
finally
@@ -1143,6 +1144,15 @@ procedure TPasSyntaxTreeBuilder.ConstructorConstraint;
1143
1144
end ;
1144
1145
end ;
1145
1146
1147
+ procedure TPasSyntaxTreeBuilder.RecordConstant ;
1148
+ begin
1149
+ FStack.Push(ntRecordConstant);
1150
+ try
1151
+ inherited ;
1152
+ finally
1153
+ FStack.Pop;
1154
+ end ;
1155
+ end ;
1146
1156
procedure TPasSyntaxTreeBuilder.RecordConstraint ;
1147
1157
begin
1148
1158
FStack.Push(ntRecordConstraint);
@@ -2190,9 +2200,17 @@ procedure TPasSyntaxTreeBuilder.RecordFieldConstant;
2190
2200
var
2191
2201
Node: TSyntaxNode;
2192
2202
begin
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;
2194
2213
try
2195
- Node.Attribute [anType]:= AttributeValues[atName];
2196
2214
inherited ;
2197
2215
finally
2198
2216
FStack.Pop;
0 commit comments