Browse Source

fcl-passrc: paswrite: allow to write procedure type

git-svn-id: trunk@37059 -
maciej-izak 8 years ago
parent
commit
597cf52a3a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      packages/fcl-passrc/src/paswrite.pp

+ 11 - 0
packages/fcl-passrc/src/paswrite.pp

@@ -49,6 +49,7 @@ type
     procedure WriteSection(ASection: TPasSection);
     procedure WriteClass(AClass: TPasClassType);
     procedure WriteVariable(AVar: TPasVariable);
+    procedure WriteProcType(AProc: TPasProcedureType);
     procedure WriteProcDecl(AProc: TPasProcedure);
     procedure WriteProcImpl(AProc: TPasProcedureImpl);
     procedure WriteProperty(AProp: TPasProperty);
@@ -159,6 +160,8 @@ begin
     WriteClass(TPasClassType(AType))
   else if AType.ClassType = TPasEnumType then
     wrtln(TPasEnumType(AType).GetDeclaration(true) + ';')
+  else if AType is TPasProcedureType then
+    WriteProcType(TPasProcedureType(AType))
   else
     raise Exception.Create('Writing not implemented for ' +
       AType.ElementTypeName + ' nodes');
@@ -333,6 +336,14 @@ begin
   wrtln(';');
 end;
 
+procedure TPasWriter.WriteProcType(AProc: TPasProcedureType);
+begin
+  wrt(TPasProcedureType(AProc).GetDeclaration(true));
+  if TPasProcedureType(AProc).CallingConvention<>ccDefault then
+    wrt('; '+cCallingConventions[TPasProcedureType(AProc).CallingConvention]);
+  wrtln(';');
+end;
+
 procedure TPasWriter.WriteProcDecl(AProc: TPasProcedure);
 var
   i: Integer;