// add/remove アクセサーを明示的に書く版 // public event EventHandler Moved // { // add {} // remove {} // } public override void VisitEventDeclaration(EventDeclarationSyntax node) { var defineType = node.ChildNodes().FirstOrDefault(x => x is IdentifierNameSyntax).ToString(); var defineName = node.ChildTokens().FirstOrDefault(x => x.Kind() == SyntaxKind.IdentifierToken).ToString(); var startLength = node.Span.Start; var endLength = node.Span.End; var parentNamespace = GetNamespace(DefineKinds.Event, startLength, endLength); UserDefinitions.Add(new UserDefinition { DefineKinds = DefineKinds.Event, Namespace = parentNamespace, DefineName = defineName, DefineFullName = $"{parentNamespace}.{defineName}", ReturnType = RemoveNamespace(defineType), SourceFile = SourceFile, StartLength = startLength, EndLength = endLength, }); base.VisitEventDeclaration(node); }