Refactoring streams and fixin various bugs

This commit is contained in:
Michael Schimmel
2026-01-13 16:23:33 +01:00
parent 717a648ad4
commit 1429278765
8 changed files with 481 additions and 178 deletions
+7
View File
@@ -45,6 +45,8 @@ type
class function Intern(const AName: string): IKeyword; static;
// Gets the name for a given keyword index.
class function GetName(AIdx: Integer): string; static;
// Gets the keyword for a given keyword index.
class function GetKeyword(AIdx: Integer): IKeyword; static;
end;
// Defines a mapping from Keywords to a generic value T
@@ -144,6 +146,11 @@ begin
FReverseMap.Free;
end;
class function TKeywordRegistry.GetKeyword(AIdx: Integer): IKeyword;
begin
Result := FReverseMap[AIdx];
end;
class function TKeywordRegistry.Intern(const AName: string): IKeyword;
var
idx: Integer;
+6 -1
View File
@@ -333,7 +333,12 @@ end;
function TDataValue.AsScalarRecord: IKeywordMapping<TScalar>;
begin
if (FKind <> vkScalarRecord) then
raise EInvalidCast.Create('Cannot read value as Record.');
begin
if (FKind = vkRecord) then
raise EInvalidCast.Create('Scalar record expected.')
else
raise EInvalidCast.Create('Cannot read value as Record.');
end;
Result := IKeywordMapping<TScalar>(FInterface);
end;