Browse Source
Merge pull request #12754 from MrJul/fix/analyzer-cctor-exception
Fix property analyzer exception with object initializers in cctors
pull/12574/head
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
src/tools/Avalonia.Analyzers/AvaloniaPropertyAnalyzer.CompileAnalyzer.cs
|
|
|
@ -168,9 +168,9 @@ public partial class AvaloniaPropertyAnalyzer |
|
|
|
|
|
|
|
foreach (var descendant in node.DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleAssignmentExpression))) |
|
|
|
{ |
|
|
|
var assignmentOperation = (IAssignmentOperation)model.GetOperation(descendant, cancellationToken)!; |
|
|
|
|
|
|
|
if (GetReferencedFieldOrProperty(assignmentOperation.Target) is { } target) |
|
|
|
if (model.GetOperation(descendant, cancellationToken) is IAssignmentOperation assignmentOperation && |
|
|
|
GetReferencedFieldOrProperty(assignmentOperation.Target) is { } target) |
|
|
|
{ |
|
|
|
RegisterAssignment(target, assignmentOperation.Value); |
|
|
|
} |
|
|
|
|