You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
procedural types with of object are not recorded correctly #245
The following code does not register the of object part:
In addition, because function and procedure are reserved words, they should not be stored in a anName attribute but in a anType attribute instead.
type
x = procedureofobject;
y:= function(x: integer): integer ofobject;
Here's the fix:
type
TAttributeValue = (atAsm, atTrue, atFunction, atProcedure, atOperator, atClassOf, atClass,
atConst, atConstructor, atDestructor, atEnum, atInterface, atNil, atNumeric,
atOut, atPointer, atName, atString, atSubRange, atVar, atType{ExplicitType},
atObject, atSealed, atAbstract, atBegin, atOf_Object{procedure of object});
var
AttributeValues: array[TAttributeValue] of string;
procedureInitAttributeValues;
varvalue: TAttributeValue;
AttributeStr: string;
beginforvalue := Low(TAttributeValue) to High(TAttributeValue) dobegin
AttributeStr:= Copy(LowerCase(GetEnumName(TypeInfo(TAttributeValue), Ord(value))), 3);
AttributeStr:= StringReplace(AttributeStr, '_', '', [rfReplaceAll]);
AttributeValues[value] := AttributeStr;
end;
end;
procedureTPasSyntaxTreeBuilder.ProceduralDirectiveOf;
var
Proc: TSyntaxNode;
begin//anType is already used for set/enum/subrange/class/record/interface/object.//It could be reused for this data, but it's a directive, not a type as such.//And it's to close to `object` proper.//It should not be a subnode, because only 'of object' is allowed.
FStack.Peek.Attribute[anKind]:= AttributeValues[atOf_Object];
inherited;
end;
Part2 of the fix:
procedureTPasSyntaxTreeBuilder.ProceduralType;
begin//procedure/function is a reserved word, so it cannot be the same as an identifier.
FStack.Push(ntType).Attribute[anType]:= Lexer.Token;
tryinherited;
finally
FStack.Pop;
end;
end;
Activity
Fix for RomanYankovsky#246 varargs, RomanYankovsky#245 proc of object, …