本文整理匯總了C#中Accessor.Annotation方法的典型用法代碼示例。如果您正苦於以下問題:C# Accessor.Annotation方法的具體用法?C# Accessor.Annotation怎麽用?C# Accessor.Annotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Accessor
的用法示例。
在下文中一共展示了Accessor.Annotation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: VisitAccessor
public virtual void VisitAccessor(Accessor accessor)
{
StartNode(accessor);
var builder = accessor.Annotation<MethodDebugInfoBuilder>();
if (builder != null)
builder.StartPosition = writer.GetLocation();
WriteAttributes(accessor.Attributes);
WriteModifiers(accessor.ModifierTokens);
// Writer doesn't write the comment before accessor if nothing has been printed yet.
// The following code works with our added comments.
if (accessor.Attributes.Count == 0 && !accessor.ModifierTokens.Any()) {
int count = 0;
foreach (var child in accessor.Children) {
if (count-- <= 0) {
cancellationToken.ThrowIfCancellationRequested();
count = CANCEL_CHECK_LOOP_COUNT;
}
var cmt = child as Comment;
if (cmt == null)
break;
cmt.AcceptVisitor(this);
}
}
var oldRef = currentMethodReference;
currentMethodReference = new object();
bool isDefault = accessor.Body.IsNull;
if (isDefault)
DebugStart(accessor);
if (accessor.Role == PropertyDeclaration.GetterRole) {
WriteKeywordIdentifier(PropertyDeclaration.GetKeywordRole);
} else if (accessor.Role == PropertyDeclaration.SetterRole) {
WriteKeywordIdentifier(PropertyDeclaration.SetKeywordRole);
} else if (accessor.Role == CustomEventDeclaration.AddAccessorRole) {
WriteKeywordIdentifier(CustomEventDeclaration.AddKeywordRole);
} else if (accessor.Role == CustomEventDeclaration.RemoveAccessorRole) {
WriteKeywordIdentifier(CustomEventDeclaration.RemoveKeywordRole);
}
if (isDefault) {
SaveDeclarationOffset();
SemicolonDebugEnd(accessor);
}
else
WriteMethodBody(accessor.Body);
if (builder != null)
builder.EndPosition = writer.GetLocation();
currentMethodReference = oldRef;
EndNode(accessor);
}