diff --git a/source/Indy.IL2CPU.Assembler/Assembler.cs b/source/Indy.IL2CPU.Assembler/Assembler.cs
index 8dcc30f15..51f5c67cc 100644
--- a/source/Indy.IL2CPU.Assembler/Assembler.cs
+++ b/source/Indy.IL2CPU.Assembler/Assembler.cs
@@ -104,7 +104,7 @@ namespace Indy.IL2CPU.Assembler {
string prefix = "\t\t";
if (x is Label) {
mOutputWriter.WriteLine();
- prefix = " ";
+ prefix = "\t";
}
mOutputWriter.WriteLine(prefix + x);
}
diff --git a/source/Indy.IL2CPU.IL.X86/Newobj.cs b/source/Indy.IL2CPU.IL.X86/Newobj.cs
index 553f76dd1..4b4c615ac 100644
--- a/source/Indy.IL2CPU.IL.X86/Newobj.cs
+++ b/source/Indy.IL2CPU.IL.X86/Newobj.cs
@@ -3,24 +3,19 @@ using System.IO;
using Mono.Cecil;
using Mono.Cecil.Cil;
using CPU = Indy.IL2CPU.Assembler.X86;
+using Asm = Indy.IL2CPU.Assembler;
namespace Indy.IL2CPU.IL.X86 {
[OpCode(Code.Newobj)]
public class Newobj: Op {
+ public readonly string CtorName;
public Newobj(Mono.Cecil.Cil.Instruction aInstruction, MethodInformation aMethodInfo)
: base(aInstruction, aMethodInfo) {
+ CtorName = new Asm.Label(((MethodReference)aInstruction.Operand).Name).Name;
}
- ///
- /// This overload takes the label name of the ctor
- ///
- ///
- public void Assemble(string aCtor) {
- new CPU.JumpAlways(aCtor);
- }
-
+
public override void Assemble() {
- //TODO: Call the other assemble
- throw new NotImplementedException("This file has been autogenerated and not been changed afterwards!");
+ Call(CtorName);
}
}
}
\ No newline at end of file
diff --git a/source/Indy.IL2CPU/Engine.cs b/source/Indy.IL2CPU/Engine.cs
index 6d90b45dc..62861cea1 100644
--- a/source/Indy.IL2CPU/Engine.cs
+++ b/source/Indy.IL2CPU/Engine.cs
@@ -139,6 +139,10 @@ namespace Indy.IL2CPU {
if (xMethodDef != null) {
QueueMethod(xMethodDef);
}
+ var xCtorDef = xReferencedType.Constructors.GetConstructor(false, xMethodReference.Parameters);
+ if (xCtorDef != null) {
+ QueueMethod(xCtorDef);
+ }
break;
}
}