示例#1
0
        public OperationStatus(OperationStatusFlag flag, string reason)
        {
            Contract.ThrowIfTrue(flag.Succeeded() && flag.HasBestEffort());

            Flag    = flag;
            Reasons = reason == null?SpecializedCollections.EmptyEnumerable <string>() : SpecializedCollections.SingletonEnumerable(reason);
        }
示例#2
0
        private OperationStatus(OperationStatusFlag flag, IEnumerable <string> reasons)
        {
            Contract.ThrowIfNull(reasons);
            Contract.ThrowIfTrue(flag.Succeeded() && flag.HasBestEffort());

            Flag    = flag;
            Reasons = reasons;
        }
        public ExtractMethodResult(
            OperationStatusFlag status,
            IEnumerable <string> reasons,
            Document document,
            SyntaxToken invocationNameToken,
            SyntaxNode methodDeclarationNode)
        {
            this.Status = status;

            this.Succeeded = status.Succeeded() && !status.HasSuggestion();
            this.SucceededWithSuggestion = status.Succeeded() && status.HasSuggestion();

            this.Reasons = (reasons ?? SpecializedCollections.EmptyEnumerable <string>()).ToReadOnlyCollection();

            this.Document              = document;
            this.InvocationNameToken   = invocationNameToken;
            this.MethodDeclarationNode = methodDeclarationNode;
        }
		public ExtractMethodResult(
			OperationStatusFlag status,
			IEnumerable<string> reasons,
			Document document,
			SyntaxToken invocationNameToken,
			SyntaxNode methodDeclarationNode)
		{
			this.Status = status;

			this.Succeeded = status.Succeeded() && !status.HasSuggestion();
			this.SucceededWithSuggestion = status.Succeeded() && status.HasSuggestion();

			this.Reasons = (reasons ?? SpecializedCollections.EmptyEnumerable<string>()).ToReadOnlyCollection();

			this.Document = document;
			this.InvocationNameToken = invocationNameToken;
			this.MethodDeclarationNode = methodDeclarationNode;
		}
        internal ExtractMethodResult(
            OperationStatusFlag status,
            IEnumerable <string> reasons,
            Document?documentWithoutFinalFormatting,
            ImmutableArray <AbstractFormattingRule> formattingRules,
            SyntaxToken invocationNameToken,
            SyntaxNode?methodDeclarationNode)
        {
            Status = status;

            Succeeded = status.Succeeded() && !status.HasSuggestion();
            SucceededWithSuggestion = status.Succeeded() && status.HasSuggestion();

            Reasons = (reasons ?? SpecializedCollections.EmptyEnumerable <string>()).ToReadOnlyCollection();

            DocumentWithoutFinalFormatting = documentWithoutFinalFormatting;
            FormattingRules       = formattingRules;
            InvocationNameToken   = invocationNameToken;
            MethodDeclarationNode = methodDeclarationNode;
        }
示例#6
0
 public static bool Failed(this OperationStatusFlag flag)
 {
     return(!flag.Succeeded());
 }
示例#7
0
 public static bool Failed(this OperationStatusFlag flag)
 => !flag.Succeeded();