Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改代码生成模块异常报错的问题 #3

Open
wants to merge 5 commits into
base: src
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions GameFrameX.CodeGenerator/Agent/AgentGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void Execute(GeneratorExecutionContext context)
continue;
}

mth.ReturnType = method.ReturnType?.ToString() ?? "void"; //Task<T>
mth.Returntype = method.ReturnType?.ToString() ?? "void"; //Task<T>
//遍历注解
foreach (var a in method.AttributeLists)
{
Expand Down Expand Up @@ -166,7 +166,7 @@ public void Execute(GeneratorExecutionContext context)
continue;
}

if (mth.IsApi && !mth.Threadsafe && !mth.ReturnType.Contains("Task"))
if (mth.IsApi && !mth.Threadsafe && !mth.Returntype.Contains("Task"))
{
context.LogError($"{fullName}.{method.Identifier.Text}, 非【Threadsafe】的【Api】接口只能是异步函数");
}
Expand All @@ -182,7 +182,7 @@ public void Execute(GeneratorExecutionContext context)
mth.Name = method.Identifier.Text;
mth.ParamDeclare = method.ParameterList.ToString(); //(int a, List<int> list)
//mth.Returntype = method.ReturnType.ToString(); //Task<T>
if (mth.Discard && !mth.ReturnType.Equals("Task") && !mth.ReturnType.Equals("ValueTask"))
if (mth.Discard && !mth.Returntype.Equals("Task") && !mth.Returntype.Equals("ValueTask"))
{
context.LogError($"{fullName}.{method.Identifier.Text}只有返回值为Task类型或ValueTask类型才能添加【Discard】注解");
}
Expand Down
4 changes: 2 additions & 2 deletions GameFrameX.CodeGenerator/Agent/AgentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ public class MthInfo
{
public string Name { get; set; }

public string ReturnType { get; set; }
public string Returntype { get; set; }

public string Declare
{
get
{
var sb = new StringBuilder();
sb.Append(Modify);
sb.Append(ReturnType);
sb.Append(Returntype);
sb.Append(" ");
sb.Append(Name);
sb.Append(Typeparams);
Expand Down