本文整理汇总了C#中IEventSymbol类的典型用法代码示例。如果您正苦于以下问题:C# IEventSymbol类的具体用法?C# IEventSymbol怎么用?C# IEventSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEventSymbol类属于命名空间,在下文中一共展示了IEventSymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEventSymbol
/// <summary>
/// Creates an event symbol that can be used to describe an event declaration.
/// </summary>
public static IEventSymbol CreateEventSymbol(
IList<AttributeData> attributes, Accessibility accessibility,
DeclarationModifiers modifiers, ITypeSymbol type,
IEventSymbol explicitInterfaceSymbol, string name,
IMethodSymbol addMethod = null, IMethodSymbol removeMethod = null, IMethodSymbol raiseMethod = null)
{
var result = new CodeGenerationEventSymbol(null, attributes, accessibility, modifiers, type, explicitInterfaceSymbol, name, addMethod, removeMethod, raiseMethod);
CodeGenerationEventInfo.Attach(result, modifiers.IsUnsafe);
return result;
}
示例2: ReadSymbol
protected override void ReadSymbol(IEventSymbol eventSymbol)
{
var @event = new Event(eventSymbol.Type, eventSymbol.Name)
{
IsAbstract = eventSymbol.IsAbstract,
IsOverride = eventSymbol.IsOverride,
IsInternal = eventSymbol.DeclaredAccessibility.HasFlag(Accessibility.Internal),
Documentation = new DocumentationComment(eventSymbol.GetDocumentationCommentXml())
};
_events.AddEvent(@event);
}
示例3: VisitEvent
public override void VisitEvent(IEventSymbol symbol)
{
if (_finished || _symbolPredicate == null || _symbolPredicate(symbol))
{
AddDocumentForMember(symbol, true, new[]
{
Metadata.Create(MetadataKeys.SpecificKind, (k, m) => symbol.Kind.ToString()),
Metadata.Create(MetadataKeys.Type, DocumentFor(symbol.Type)),
Metadata.Create(MetadataKeys.Overridden, DocumentFor(symbol.OverriddenEvent))
});
}
}
示例4: GetParsedEvent
private SDEvent GetParsedEvent(IEventSymbol eve)
{
var sdEvent = new SDEvent(eve.GetIdentifier())
{
Name = eve.Name,
DeclaringType = _typeRefParser.GetParsedTypeReference(eve.ContainingType),
Accessibility = eve.DeclaredAccessibility.ToString().ToLower(),
Documentations = DocumentationParser.ParseDocumentation(eve)
};
ParserOptions.SDRepository.AddMember(sdEvent);
return sdEvent;
}
示例5: AddEventTo
internal static CompilationUnitSyntax AddEventTo(
CompilationUnitSyntax destination,
IEventSymbol @event,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GenerateEventDeclaration(@event, CodeGenerationDestination.CompilationUnit, options);
// Place the event depending on its shape. Field style events go with fields, property
// style events go with properties. If there
var members = Insert(destination.Members, declaration, options, availableIndices,
after: list => AfterMember(list, declaration), before: list => BeforeMember(list, declaration));
return destination.WithMembers(members.ToSyntaxList());
}
示例6: AddEventTo
internal static TypeDeclarationSyntax AddEventTo(
TypeDeclarationSyntax destination,
IEventSymbol @event,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GenerateEventDeclaration(@event, GetDestination(destination), options);
var members = Insert(destination.Members, declaration, options, availableIndices,
after: list => AfterMember(list, declaration), before: list => BeforeMember(list, declaration));
// Find the best place to put the field. It should go after the last field if we already
// have fields, or at the beginning of the file if we don't.
return AddMembersTo(destination, members);
}
示例7: GetParsedEvent
private SDEvent GetParsedEvent(IEventSymbol eve)
{
var syntaxReference = eve.DeclaringSyntaxReferences.Any() ? eve.DeclaringSyntaxReferences.Single() : null;
var sdEvent = new SDEvent(eve.GetIdentifier())
{
Name = eve.Name,
DeclaringType = _typeRefParser.GetParsedTypeReference(eve.ContainingType),
Accessibility = eve.DeclaredAccessibility.ToString().ToLower(),
Documentations = DocumentationParser.ParseDocumentation(eve),
Region = syntaxReference != null ? new SDRegion
{
Start = syntaxReference.Span.Start,
StartLine = syntaxReference.SyntaxTree.GetLineSpan(syntaxReference.Span).StartLinePosition.Line + 1,
EndLine = syntaxReference.SyntaxTree.GetLineSpan(syntaxReference.Span).EndLinePosition.Line + 1,
End = syntaxReference.Span.End,
FilePath = syntaxReference.SyntaxTree.FilePath,
Filename = Path.GetFileName(syntaxReference.SyntaxTree.FilePath)
} : null
};
ParserOptions.SDRepository.AddMember(sdEvent);
return sdEvent;
}
示例8: GetIsUnsafe
public static bool GetIsUnsafe(IEventSymbol @event)
{
return GetIsUnsafe(GetInfo(@event));
}
示例9: Attach
public static void Attach(IEventSymbol @event, bool isUnsafe)
{
var info = new CodeGenerationEventInfo(isUnsafe);
s_eventToInfoMap.Add(@event, info);
}
示例10: GetEiiContainerTypeName
private static string GetEiiContainerTypeName(IEventSymbol symbol, IFilterVisitor filterVisitor)
{
if (symbol.ExplicitInterfaceImplementations.Length == 0)
{
return null;
}
for (int i = 0; i < symbol.ExplicitInterfaceImplementations.Length; i++)
{
if (filterVisitor.CanVisitApi(symbol.ExplicitInterfaceImplementations[i]))
{
return NameVisitorCreator.GetCSharp(NameOptions.UseAlias | NameOptions.WithGenericParameter).GetName(symbol.ExplicitInterfaceImplementations[i].ContainingType);
}
}
Debug.Fail("Should not be here!");
return null;
}
示例11: GetEventSyntax
private string GetEventSyntax(IEventSymbol symbol, IFilterVisitor filterVisitor)
{
ExplicitInterfaceSpecifierSyntax eii = null;
if (symbol.ExplicitInterfaceImplementations.Length > 0)
{
eii = SyntaxFactory.ExplicitInterfaceSpecifier(SyntaxFactory.ParseName(GetEiiContainerTypeName(symbol, filterVisitor)));
}
return RemoveBraces(
SyntaxFactory.EventDeclaration(
GetAttributes(symbol, filterVisitor),
SyntaxFactory.TokenList(GetMemberModifiers(symbol)),
SyntaxFactory.Token(SyntaxKind.EventKeyword),
GetTypeSyntax(symbol.Type),
eii,
SyntaxFactory.Identifier(GetMemberName(symbol, filterVisitor)),
SyntaxFactory.AccessorList()
).NormalizeWhitespace().ToString()
);
}
示例12: GetMemberModifiers
private static IEnumerable<SyntaxToken> GetMemberModifiers(IEventSymbol symbol)
{
if (symbol.ContainingType.TypeKind != TypeKind.Interface)
{
switch (symbol.DeclaredAccessibility)
{
case Accessibility.Protected:
case Accessibility.ProtectedOrInternal:
yield return SyntaxFactory.Token(SyntaxKind.ProtectedKeyword);
break;
case Accessibility.Public:
yield return SyntaxFactory.Token(SyntaxKind.PublicKeyword);
break;
case Accessibility.ProtectedAndInternal:
case Accessibility.Internal:
case Accessibility.Private:
default:
break;
}
}
if (symbol.IsStatic)
{
yield return SyntaxFactory.Token(SyntaxKind.StaticKeyword);
}
if (symbol.IsAbstract && symbol.ContainingType.TypeKind != TypeKind.Interface)
{
yield return SyntaxFactory.Token(SyntaxKind.AbstractKeyword);
}
if (symbol.IsVirtual)
{
yield return SyntaxFactory.Token(SyntaxKind.VirtualKeyword);
}
if (symbol.IsOverride)
{
yield return SyntaxFactory.Token(SyntaxKind.OverrideKeyword);
}
if (symbol.IsSealed)
{
yield return SyntaxFactory.Token(SyntaxKind.SealedKeyword);
}
}
示例13: HaveSameSignature
private bool HaveSameSignature(IEventSymbol event1, IEventSymbol event2, bool caseSensitive)
{
return IdentifiersMatch(event1.Name, event2.Name, caseSensitive);
}
示例14: CreateEventSymbol
internal static IEventSymbol CreateEventSymbol(
IEventSymbol @event,
IList<AttributeData> attributes = null,
Accessibility? accessibility = null,
DeclarationModifiers? modifiers = null,
IEventSymbol explicitInterfaceSymbol = null,
string name = null,
IMethodSymbol addMethod = null,
IMethodSymbol removeMethod = null)
{
return CodeGenerationSymbolFactory.CreateEventSymbol(
attributes,
accessibility ?? @event.DeclaredAccessibility,
modifiers ?? @event.GetSymbolModifiers(),
@event.Type,
explicitInterfaceSymbol,
name ?? @event.Name,
addMethod,
removeMethod);
}
示例15: WrappedEventSymbol
public WrappedEventSymbol(IEventSymbol eventSymbol, bool canImplementImplicitly, IDocumentationCommentFormattingService docCommentFormattingService)
: base(eventSymbol, canImplementImplicitly, docCommentFormattingService)
{
_symbol = eventSymbol;
}