/// <summary> /// </summary> /// <param name="typeIn"> /// </param> /// <param name="llvmWriter"> /// </param> public static void WriteInitObjectMethod(this IType typeIn, LlvmWriter llvmWriter) { var writer = llvmWriter.Output; var classType = typeIn.ToClass(); var method = new SynthesizedInitMethod(classType, llvmWriter); writer.WriteLine("; Init Object method"); var opCode = OpCodePart.CreateNop; llvmWriter.WriteMethodStart(method, null); llvmWriter.WriteLlvmLoad(opCode, classType, new FullyDefinedReference(llvmWriter.GetThisName(), llvmWriter.ThisType), true, true); writer.WriteLine(string.Empty); llvmWriter.WriteInitObject(opCode); writer.WriteLine("ret void"); llvmWriter.WriteMethodEnd(method, null); }
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="llvmWriter"> /// </param> /// <param name="opCode"> /// </param> public static void WriteCallInitObjectMethod(this IType type, LlvmWriter llvmWriter, OpCodePart opCode) { var writer = llvmWriter.Output; var method = new SynthesizedInitMethod(type, llvmWriter); writer.WriteLine(string.Empty); writer.WriteLine("; call Init Object method"); var opCodeNope = OpCodePart.CreateNop; opCodeNope.UsedBy = new UsedByInfo(opCode); llvmWriter.WriteCall(opCodeNope, method, false, true, false, opCode.Result, llvmWriter.tryScopes.Count > 0 ? llvmWriter.tryScopes.Peek() : null); }