當前位置: 首頁>>代碼示例>>C#>>正文


C# Accessor.Annotation方法代碼示例

本文整理匯總了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);
		}
開發者ID:0xd4d,項目名稱:NRefactory,代碼行數:50,代碼來源:CSharpOutputVisitor.cs


注:本文中的Accessor.Annotation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。