/// <summary> /// </summary> /// <param name="typeIn"> /// </param> /// <param name="llvmWriter"> /// </param> public static void WriteGetTypeStaticMethod(this IType typeIn, LlvmWriter llvmWriter) { var writer = llvmWriter.Output; var classType = typeIn.ToClass(); var systemType = llvmWriter.ResolveType("System.Type"); var method = new SynthesizedGetTypeStaticMethod(classType, llvmWriter); writer.WriteLine("; Get Type Object method"); var opCode = OpCodePart.CreateNop; llvmWriter.WriteMethodStart(method, null); llvmWriter.WriteGetTypeStaticObject(opCode, classType, systemType); writer.Write("ret "); systemType.WriteTypePrefix(writer); writer.Write(" "); llvmWriter.WriteResult(opCode.Result); llvmWriter.WriteMethodEnd(method, null); }
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="llvmWriter"> /// </param> /// <param name="opCode"> /// </param> public static void WriteCallGetTypeObjectMethod(this IType type, LlvmWriter llvmWriter, OpCodePart opCode) { var writer = llvmWriter.Output; var method = new SynthesizedGetTypeStaticMethod(type, llvmWriter); writer.WriteLine(string.Empty); writer.WriteLine("; call .getType Object method"); var opCodeNope = OpCodePart.CreateNop; opCodeNope.UsedBy = new UsedByInfo(opCode); llvmWriter.WriteCall(opCodeNope, method, false, false, false, opCode.Result, llvmWriter.tryScopes.Count > 0 ? llvmWriter.tryScopes.Peek() : null); opCode.Result = opCodeNope.Result; writer.WriteLine(string.Empty); writer.WriteLine("; End of Getting data"); }