mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 02:49:28 +02:00
* Write more types
git-svn-id: trunk@37443 -
This commit is contained in:
parent
b1e4515896
commit
352f99c15f
@ -3506,7 +3506,12 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result:='Set of '+EnumType.Name;
|
if (EnumType.Name<>'') then
|
||||||
|
Result:='Set of '+EnumType.Name
|
||||||
|
else if (enumtype is TPasRangeType) then
|
||||||
|
Result:='Set of '+TPasRangeType(enumtype).RangeStart+'..'+TPasRangeType(enumtype).RangeEnd
|
||||||
|
else
|
||||||
|
Raise EParserError.Create('Unknown pastree enum element = '+EnumType.ClassName);
|
||||||
If Full then
|
If Full then
|
||||||
Result:=Name+' = '+Result;
|
Result:=Name+' = '+Result;
|
||||||
end;
|
end;
|
||||||
|
@ -83,7 +83,11 @@ type
|
|||||||
constructor Create(AStream: TStream); virtual;
|
constructor Create(AStream: TStream); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure AddForwardClasses(aSection: TPasSection); virtual;
|
procedure AddForwardClasses(aSection: TPasSection); virtual;
|
||||||
|
procedure WriteRangeType(AType: TPasRangeType); virtual;
|
||||||
procedure WriteEnumType(AType: TPasEnumType); virtual;
|
procedure WriteEnumType(AType: TPasEnumType); virtual;
|
||||||
|
procedure WriteFileType(AType: TPasFileType); virtual;
|
||||||
|
procedure WriteSetType(AType: TPasSetType); virtual;
|
||||||
|
procedure WritePointerType(AType: TPasPointerType); virtual;
|
||||||
procedure WriteElement(AElement: TPasElement);virtual;
|
procedure WriteElement(AElement: TPasElement);virtual;
|
||||||
procedure WriteType(AType: TPasType; Full : Boolean = True);virtual;
|
procedure WriteType(AType: TPasType; Full : Boolean = True);virtual;
|
||||||
procedure WriteProgram(aModule : TPasProgram); virtual;
|
procedure WriteProgram(aModule : TPasProgram); virtual;
|
||||||
@ -257,6 +261,30 @@ begin
|
|||||||
Add(Atype.GetDeclaration(true));
|
Add(Atype.GetDeclaration(true));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPasWriter.WriteSetType(AType: TPasSetType);
|
||||||
|
|
||||||
|
begin
|
||||||
|
Add(Atype.GetDeclaration(true));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPasWriter.WritePointerType(AType: TPasPointerType);
|
||||||
|
|
||||||
|
begin
|
||||||
|
Add(Atype.GetDeclaration(true));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPasWriter.WriteFileType(AType: TPasFileType);
|
||||||
|
|
||||||
|
begin
|
||||||
|
Add(Atype.GetDeclaration(true));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPasWriter.WriteRangeType(AType: TPasRangeType);
|
||||||
|
|
||||||
|
begin
|
||||||
|
Add(Atype.GetDeclaration(true));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPasWriter.WriteType(AType: TPasType; Full : Boolean = True);
|
procedure TPasWriter.WriteType(AType: TPasType; Full : Boolean = True);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -269,19 +297,26 @@ begin
|
|||||||
WriteClass(TPasClassType(AType))
|
WriteClass(TPasClassType(AType))
|
||||||
else if AType.ClassType = TPasEnumType then
|
else if AType.ClassType = TPasEnumType then
|
||||||
WriteEnumType(TPasEnumType(AType))
|
WriteEnumType(TPasEnumType(AType))
|
||||||
|
else if AType is TPasSetType then
|
||||||
|
WriteSetType(TPasSetType(AType))
|
||||||
else if AType is TPasProcedureType then
|
else if AType is TPasProcedureType then
|
||||||
WriteProcType(TPasProcedureType(AType))
|
WriteProcType(TPasProcedureType(AType))
|
||||||
else if AType is TPasArrayType then
|
else if AType is TPasArrayType then
|
||||||
WriteArrayType(TPasArrayType(AType))
|
WriteArrayType(TPasArrayType(AType))
|
||||||
|
else if AType is TPasRangeType then
|
||||||
|
WriteRangeType(TPasRangeType(AType))
|
||||||
else if AType is TPasRecordType then
|
else if AType is TPasRecordType then
|
||||||
WriteRecordType(TPasRecordType(AType))
|
WriteRecordType(TPasRecordType(AType))
|
||||||
else if AType is TPasAliasType then
|
else if AType is TPasAliasType then
|
||||||
WriteAliasType(TPasAliasType(AType))
|
WriteAliasType(TPasAliasType(AType))
|
||||||
|
else if AType is TPasFileType then
|
||||||
|
WriteFileType(TPasFileType(AType))
|
||||||
else if AType is TPasPointerType then
|
else if AType is TPasPointerType then
|
||||||
Add(AType.GetDeclaration(true))
|
WritePointerType(TPasPointerType(AType))
|
||||||
|
else if AType is TPasPointerType then
|
||||||
|
WriteRangeType(TPasRangeType(AType))
|
||||||
else
|
else
|
||||||
raise EPasWriter.Create('Writing not implemented for ' +
|
Raise EPasWriter.CreateFmt('Writing not implemented for %s nodes',[AType.ElementTypeName]);
|
||||||
AType.ElementTypeName + ' nodes');
|
|
||||||
if Full then
|
if Full then
|
||||||
AddLn(';');
|
AddLn(';');
|
||||||
end;
|
end;
|
||||||
@ -892,7 +927,7 @@ procedure TPasWriter.WriteProcImpl(AProc: TPasProcedureImpl);
|
|||||||
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
E,PE :TPasElement;
|
E,PE : TPasElement;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
PrepareDeclSection('');
|
PrepareDeclSection('');
|
||||||
@ -912,6 +947,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
AddLn(';');
|
AddLn(';');
|
||||||
IncDeclSectionLevel;
|
IncDeclSectionLevel;
|
||||||
|
PE:=Nil;
|
||||||
for i := 0 to AProc.Locals.Count - 1 do
|
for i := 0 to AProc.Locals.Count - 1 do
|
||||||
begin
|
begin
|
||||||
E:=TPasElement(AProc.Locals[i]);
|
E:=TPasElement(AProc.Locals[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user