public void WriteDocs(FileWriter writer, CreateMethod method, string sectionTitle, Action?writeSection) { const string typeName = "Instruction"; docWriter.BeginWrite(writer); foreach (var doc in method.Docs) { docWriter.WriteDocLine(writer, doc, typeName); } docWriter.WriteLine(writer, string.Empty); if (writeSection is not null) { docWriter.WriteLine(writer, $"# {sectionTitle}"); docWriter.WriteLine(writer, string.Empty); writeSection(); docWriter.WriteLine(writer, string.Empty); } docWriter.WriteLine(writer, "# Arguments"); docWriter.WriteLine(writer, string.Empty); for (int i = 0; i < method.Args.Count; i++) { var arg = method.Args[i]; docWriter.Write($"* `{idConverter.Argument(arg.Name)}`: "); docWriter.WriteDocLine(writer, arg.Doc, typeName); } docWriter.EndWrite(writer); }
public GeneratedMethodInfo(CreateMethod method, bool canFail, string rustMethodName, string pythonMethodName, IdentifierConverter rustIdConverter, IdentifierConverter pythonIdConverter) { Method = method; CanFail = canFail; RustMethodName = rustMethodName; PythonMethodName = pythonMethodName; ArgInfos = new MethodArgInfo[method.Args.Count]; for (int i = 0; i < method.Args.Count; i++) { var origName = method.Args[i].Name; var rustName = rustIdConverter.Argument(origName); var pythonName = pythonIdConverter.Argument(origName); ArgInfos[i] = new MethodArgInfo(rustName: rustName, pythonName: pythonName); } }
public GeneratedMethodInfo(CreateMethod method, bool canFail, string rustMethodName, string luaMethodName, IdentifierConverter rustIdConverter, IdentifierConverter luaIdConverter) { Method = method; CanFail = canFail; RustMethodName = rustMethodName; LuaMethodName = luaMethodName; ArgInfos = new MethodArgInfo[method.Args.Count]; Overloads = new(); for (int i = 0; i < method.Args.Count; i++) { var origName = method.Args[i].Name; var rustName = rustIdConverter.Argument(origName); var luaName = luaIdConverter.Argument(origName); ArgInfos[i] = new MethodArgInfo(rustName: rustName, luaName: luaName); } }