XFEExtension.NetCore.ServerInteractive
[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig
关注
0
Fork
0
Star
0
返回提交历史
Modified
XFEExtension.NetCore.ServerInteractive.SourceGenerator/EntryPointGenerator.cs
+6
-8
XFEstudio/XFEExtension.NetCore.ServerInteractive
修改报错类型
499a360
代码差异
1 个文件
+6
-8
@@ -17,15 +17,16 @@ namespace XFEExtension.NetCore.ServerInteractive.SourceGenerator;
17
17
public class EntryPointGenerator : IIncrementalGenerator
18
18
{
19
19
private static readonly DiagnosticDescriptor NonPartialClassRule = new(
20
id: "XFESI001",
20
id: "XFE0003",
21
21
title: "包含EntryPoint方法的类必须为partial",
22
22
messageFormat: "类'{0}'必须声明为partial以便增量生成器可以生成入口点代码",
23
23
category: "XFEServerInteractive",
24
24
defaultSeverity: DiagnosticSeverity.Error,
25
helpLinkUri: "",
25
26
isEnabledByDefault: true);
26
27
27
28
private static readonly DiagnosticDescriptor MethodMustBeParameterlessRule = new(
28
id: "XFESI002",
29
id: "XFE0004",
29
30
title: "EntryPoint方法不能有参数",
30
31
messageFormat: "方法'{0}'标记了[EntryPoint]但包含参数,入口点方法必须是无参数的",
31
32
category: "XFEServerInteractive",
@@ -33,7 +34,7 @@ public class EntryPointGenerator : IIncrementalGenerator
33
34
isEnabledByDefault: true);
34
35
35
36
private static readonly DiagnosticDescriptor InvalidReturnTypeRule = new(
36
id: "XFESI003",
37
id: "XFE0005",
37
38
title: "EntryPoint方法返回类型无效",
38
39
messageFormat: "方法'{0}'的返回类型'{1}'无效,入口点方法必须返回void或Task",
39
40
category: "XFEServerInteractive",
@@ -41,7 +42,7 @@ public class EntryPointGenerator : IIncrementalGenerator
41
42
isEnabledByDefault: true);
42
43
43
44
private static readonly DiagnosticDescriptor InvalidPathCharactersRule = new(
44
id: "XFESI004",
45
id: "XFE0006",
45
46
title: "EntryPoint路径包含无效字符",
46
47
messageFormat: "入口点路径'{0}'包含无效字符(引号或反斜杠),这些字符不允许在路径中使用",
47
48
category: "XFEServerInteractive",
@@ -65,10 +66,7 @@ public class EntryPointGenerator : IIncrementalGenerator
65
66
static (spc, source) => Execute(source.Left, source.Right!, spc));
66
67
}
67
68
68
private static bool IsCandidateMethod(SyntaxNode node)
69
{
70
return node is MethodDeclarationSyntax m && m.AttributeLists.Count > 0;
71
}
69
private static bool IsCandidateMethod(SyntaxNode node) => node is MethodDeclarationSyntax { AttributeLists.Count: > 0 };
72
70
73
71
private static MethodCandidate? GetMethodForGeneration(GeneratorSyntaxContext context)
74
72
{