public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) { if (isSealedType) return; var body = constructorDeclaration.Body; if (body == null || body.IsNull) return; var callFinder = new VirtualCallFinderVisitor(context); body.AcceptVisitor(callFinder); FoundIssues.AddRange(callFinder.FoundIssues); }
static bool TryGetDiagnostic(SyntaxNodeAnalysisContext nodeContext, out IEnumerable<Diagnostic> diagnostic) { diagnostic = default(IEnumerable<Diagnostic>); var node = nodeContext.Node as ConstructorDeclarationSyntax; var type = node.Parent as TypeDeclarationSyntax; if (type == null || type.Modifiers.Any(m => m.IsKind(SyntaxKind.SealedKeyword) || m.IsKind(SyntaxKind.StaticKeyword))) { return false; } var visitor = new VirtualCallFinderVisitor(nodeContext, node, type); visitor.Visit(node.Body); diagnostic = visitor.Diagnostics; return true; }
static bool TryGetDiagnostic(SyntaxNodeAnalysisContext nodeContext, out IEnumerable <Diagnostic> diagnostic) { diagnostic = default(IEnumerable <Diagnostic>); var node = nodeContext.Node as ConstructorDeclarationSyntax; var type = node.Parent as TypeDeclarationSyntax; if (type == null || type.Modifiers.Any(m => m.IsKind(SyntaxKind.SealedKeyword) || m.IsKind(SyntaxKind.StaticKeyword))) { return(false); } var visitor = new VirtualCallFinderVisitor(nodeContext, node, type); visitor.Visit(node.Body); diagnostic = visitor.Diagnostics; return(true); }
public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) { if (isSealedType) { return; } var body = constructorDeclaration.Body; if (body == null || body.IsNull) { return; } var callFinder = new VirtualCallFinderVisitor(context); body.AcceptVisitor(callFinder); FoundIssues.AddRange(callFinder.FoundIssues); }
public GatherVisitor(BaseRefactoringContext context) : base(context) { CallFinder = new VirtualCallFinderVisitor(context); }