The record constants are not recorded.
In addition the ntField nodes are constructed different from ntField nodes elsewhere.
All ntField should be constructed the same, so that we don't need different code to decode them
depending on the context.
The fix:
procedure TPasSyntaxTreeBuilder.RecordConstant;
begin
FStack.Push(ntRecordConstant);
try
inherited;
finally
FStack.Pop;
end;
end;
procedure TPasSyntaxTreeBuilder.RecordFieldConstant;
var
Node: TSyntaxNode;
begin
//A field in a record constant should have exactly the same layout
//as a field in a class.
//ntField (class)
//+-- ntName (anName = name)
//+-- ntType
//Recordconstant
//ntField (recordconstant)
//+-- ntName
//+-- ntExpression.
FStack.Push(ntField).AddChild(ntName).Attribute[anName]:= Lexer.Token;
try
inherited;
finally
FStack.Pop;
end;
end;
Consider the following example:
The record constants are not recorded. In addition the
ntField
nodes are constructed different fromntField
nodes elsewhere. AllntField
should be constructed the same, so that we don't need different code to decode them depending on the context.The fix: