protected override bool IsFunction(SyntaxNode node) { var property = node as PropertyDeclarationSyntax; if (property != null && property.ExpressionBody != null) { return(true); } var method = node as MethodDeclarationSyntax; if (method != null && method.ExpressionBody != null) { return(true); } if (FunctionKinds.Contains(node.Kind()) && node.ChildNodes().Any(c => c.IsKind(SyntaxKind.Block))) { // Non-abstract, non-interface methods return(true); } var accessor = node as AccessorDeclarationSyntax; if (accessor != null) { if (accessor.Body != null) { return(true); } var prop = accessor.Parent.Parent as BasePropertyDeclarationSyntax; if (prop == null) { // Unexpected return(false); } if (prop.Modifiers.Any(m => m.IsKind(SyntaxKind.AbstractKeyword))) { return(false); } return(!(prop.Parent is InterfaceDeclarationSyntax)); } return(false); }
protected override bool IsFunction(SyntaxNode node) { if (!FunctionKinds.Contains(node.Kind()) || !MethodBlocks.Contains(node.Parent.Kind()) || node.Parent.Parent.IsKind(SyntaxKind.InterfaceBlock)) { return(false); } if (node is MethodBaseSyntax method && method.Modifiers.Any(m => m.IsKind(SyntaxKind.MustOverrideKeyword))) { return(false); } return(true); }
protected override bool IsFunction(SyntaxNode node) { if (node is PropertyDeclarationSyntax property && property.ExpressionBody != null) { return(true); } if (node is MethodDeclarationSyntax method && method.ExpressionBody != null) { return(true); } if (FunctionKinds.Contains(node.Kind()) && node.ChildNodes().Any(SyntaxKind.Block)) { // Non-abstract, non-interface methods return(true); } if (node is AccessorDeclarationSyntax accessor) { if (accessor.Body != null) { return(true); } if (!(accessor.Parent.Parent is BasePropertyDeclarationSyntax prop)) { // Unexpected return(false); } if (prop.Modifiers.Any(SyntaxKind.AbstractKeyword)) { return(false); } return(!(prop.Parent is InterfaceDeclarationSyntax)); } return(false); }
private static bool IsFunction(SyntaxNode node) { return(FunctionKinds.Contains(node.Kind())); }