Skip to content

Commit d89d705

Browse files
committed
feat:同步ET更新
1 parent 3b372a3 commit d89d705

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Tools/Analyzer/Analyzer/AddChildTypeAnalyzer.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context)
8585

8686
// 获取实体类 ChildType标签的约束类型
8787
INamedTypeSymbol? availableChildTypeSymbol = null;
88+
bool hasChildTypeAttribute = false;
8889
foreach (AttributeData? attributeData in parentTypeSymbol.GetAttributes())
8990
{
9091
if (attributeData.AttributeClass?.Name == "ChildTypeAttribute")
9192
{
93+
hasChildTypeAttribute = true;
9294
if (!(attributeData.ConstructorArguments[0].Value is INamedTypeSymbol s))
9395
{
9496
continue;
@@ -98,7 +100,10 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context)
98100
}
99101
}
100102

101-
103+
if (hasChildTypeAttribute &&(availableChildTypeSymbol==null))
104+
{
105+
return;
106+
}
102107

103108
// 获取 child实体类型
104109
ISymbol? childTypeSymbol = null;
@@ -175,6 +180,7 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context)
175180
return;
176181
}
177182

183+
178184
// 判断child类型是否属于约束类型
179185
if (availableChildTypeSymbol?.ToString() == childTypeSymbol.ToString())
180186
{

0 commit comments

Comments
 (0)