瀏覽代碼

fcl-passrc: paswrite: allow to write procedure type

git-svn-id: trunk@37059 -
maciej-izak 8 年之前
父節點
當前提交
597cf52a3a
共有 1 個文件被更改,包括 11 次插入0 次删除
  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;