public override void VisitDelegateDeclaration(DelegateDeclarationSyntax node) { var returnType = node.ChildNodes().FirstOrDefault().ToString(); var isSubMethod = node.ChildNodes().FirstOrDefault().ChildTokens().Any(x => x.Kind() == SyntaxKind.VoidKeyword); var isPartial = node.ChildTokens().Any(x => x.Kind() == SyntaxKind.PartialKeyword); var defineName = node.ChildTokens().FirstOrDefault(x => x.Kind() == SyntaxKind.IdentifierToken).ToString(); // ジェネリック型を定義している場合 if (node.ChildNodes().OfType <TypeParameterListSyntax>().Any()) { var listNode = node.ChildNodes().OfType <TypeParameterListSyntax>().FirstOrDefault(); var genericTypes = listNode .ChildNodes() .OfType <TypeParameterSyntax>() .Select(x => x.ChildTokens().FirstOrDefault(y => y.Kind() == SyntaxKind.IdentifierToken).ToString()); defineName = $"{defineName}<{string.Join(", ", genericTypes)}>"; } var methodArguments = new List <MethodArgument>(); if (node.ChildNodes().OfType <ParameterListSyntax>().FirstOrDefault().ChildNodes().Any()) { var listNode = node.ChildNodes().OfType <ParameterListSyntax>().FirstOrDefault(); methodArguments = GetMethodArguments(listNode); } var startLength = node.Span.Start; var endLength = node.Span.End; var parentNamespace = GetNamespace(DefineKinds.Delegate, startLength, endLength); UserDefinitions.Add(new UserDefinition { DefineKinds = DefineKinds.Delegate, IsPartial = isPartial, Namespace = parentNamespace, DefineName = defineName, DefineFullName = $"{parentNamespace}.{defineName}", MethodArguments = methodArguments, ReturnType = RemoveNamespace(returnType), SourceFile = SourceFile, StartLength = startLength, EndLength = endLength, }); base.VisitDelegateDeclaration(node); }