PythonToCSharpConverter.cs:36 -- 移除未使用的 indentLevel 变量

Program.test.cs -- 将顶层语句改为 ManualTest.RunAsync() 方法,消除入口点冲突
BatchConversionService.cs:96 -- options 可空参数添加 ?? new ConversionOptions() 空值回退
Co-authored-by: monkeycode-ai <monkeycode-ai@chaitin.com>
This commit is contained in:
monkeycode-ai
2026-06-16 17:06:24 +08:00
parent db536cfb2c
commit 2fcc22b501
3 changed files with 17 additions and 10 deletions
+8
View File
@@ -2,6 +2,12 @@ using CodePlay.Core.Parsers;
using CodePlay.Core.Converters;
using CodePlay.Core.Common;
namespace CodePlay.CLI.Tests;
public class ManualTest
{
public static async Task RunAsync()
{
var parser = new CSharpParser();
var converter = new CSharpToJavaConverter();
@@ -21,3 +27,5 @@ var result = await converter.ConvertAsync(tree, LanguageType.Java);
Console.WriteLine("Success: " + result.Success);
Console.WriteLine("=== Code ===");
Console.WriteLine(result.TransformedCode ?? "NULL");
}
}
@@ -33,7 +33,6 @@ public class PythonToCSharpConverter : IConverter
sb.AppendLine();
var lines = pythonCode.Split('\n');
var indentLevel = 0;
foreach (var line in lines)
{
@@ -93,7 +93,7 @@ public class BatchConversionService : IBatchConversionService
var sourceCode = await File.ReadAllTextAsync(sourceFile, cancellationToken);
var conversionResult = await _conversionService.ConvertAsync(
sourceCode, sourceLanguage.ToName(), targetLanguage.ToName(), options);
sourceCode, sourceLanguage.ToName(), targetLanguage.ToName(), options ?? new ConversionOptions());
if (conversionResult.Success)
{