ソースを参照

* fixed infinite Java assembler writer create loop after r31625

git-svn-id: trunk@31666 -
Jonas Maebe 10 年 前
コミット
f4c868b06a
1 ファイル変更14 行追加3 行削除
  1. 14 3
      compiler/jvm/agjasmin.pas

+ 14 - 3
compiler/jvm/agjasmin.pas

@@ -1078,11 +1078,22 @@ implementation
         nestedstructs.free;
       end;
 
+
     constructor TJasminAssembler.Create(info: pasminfo; smart: boolean);
       begin
-        inherited CreateWithWriter(info,TJasminAssemblerOutputFile.Create(self),true,smart);
-        InstrWriter:=TJasminInstrWriter.Create(self);
-        asmfiles:=TCmdStrList.Create;
+        { this is a bit dirty: the "main" constructor is is this one, which is
+          called by TExternalAssembler.CreateWithWriter(). That means the call
+          below to CreateWithWriter will end up here again when it calls create.
+          It will first initialise fwriter though, so we can check that field,
+          and otherwise call the inherited create }
+        if not assigned(writer) then
+          begin
+            CreateWithWriter(info,TJasminAssemblerOutputFile.Create(self),true,smart);
+            InstrWriter:=TJasminInstrWriter.Create(self);
+            asmfiles:=TCmdStrList.Create;
+          end
+        else
+          inherited;
       end;