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


C# CSharp.FlowBranching類代碼示例

本文整理匯總了C#中Mono.CSharp.FlowBranching的典型用法代碼示例。如果您正苦於以下問題:C# FlowBranching類的具體用法?C# FlowBranching怎麽用?C# FlowBranching使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FlowBranching類屬於Mono.CSharp命名空間,在下文中一共展示了FlowBranching類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateBranching

		public static FlowBranching CreateBranching (FlowBranching parent, BranchingType type, Block block, Location loc)
		{
			switch (type) {
			case BranchingType.Exception:
			case BranchingType.Labeled:
			case BranchingType.Toplevel:
			case BranchingType.TryCatch:
				throw new InvalidOperationException ();

			case BranchingType.Switch:
				return new FlowBranchingBreakable (parent, type, SiblingType.SwitchSection, block, loc);

			case BranchingType.Block:
				return new FlowBranchingBlock (parent, type, SiblingType.Block, block, loc);

			case BranchingType.Loop:
				return new FlowBranchingBreakable (parent, type, SiblingType.Conditional, block, loc);

			case BranchingType.Embedded:
				return new FlowBranchingContinuable (parent, type, SiblingType.Conditional, block, loc);

			default:
				return new FlowBranchingBlock (parent, type, SiblingType.Conditional, block, loc);
			}
		}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:25,代碼來源:flowanalysis.cs

示例2: FlowBranching

        // <summary>
        //   Creates a new flow branching which is contained in `parent'.
        //   You should only pass non-null for the `block' argument if this block
        //   introduces any new variables - in this case, we need to create a new
        //   usage vector with a different size than our parent's one.
        // </summary>
        protected FlowBranching(FlowBranching parent, BranchingType type, SiblingType stype,
            Block block, Location loc)
        {
            Parent = parent;
            Block = block;
            Location = loc;
            Type = type;
            id = ++next_id;

            UsageVector vector;
            if (Block != null) {
                UsageVector parent_vector = parent != null ? parent.CurrentUsageVector : null;
                vector = new UsageVector (stype, parent_vector, Block, loc, Block.AssignableSlots);
            } else {
                vector = new UsageVector (stype, Parent.CurrentUsageVector, null, loc);
            }

            AddSibling (vector);
        }
開發者ID:speier,項目名稱:shake,代碼行數:25,代碼來源:flowanalysis.cs

示例3: DoPropagateFinally

			protected override void DoPropagateFinally (FlowBranching parent)
			{
				parent.AddContinueOrigin (Vector, Loc);
			}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:4,代碼來源:flowanalysis.cs

示例4: IsFullyInitialized

		// <summary>
		//   A struct's constructor must always assign all fields.
		//   This method checks whether it actually does so.
		// </summary>
		public bool IsFullyInitialized (FlowBranching branching, VariableInfo vi, Location loc)
		{
			if (struct_info == null)
				return true;

			bool ok = true;
			for (int i = 0; i < struct_info.Count; i++) {
				FieldInfo field = struct_info.Fields [i];

				if (!branching.IsFieldAssigned (vi, field.Name)) {
					FieldBase fb = TypeManager.GetField (field);
					if (fb != null && (fb.ModFlags & Modifiers.BACKING_FIELD) != 0) {
						Report.Error (843, loc,
							"An automatically implemented property `{0}' must be fully assigned before control leaves the constructor. Consider calling default contructor",
							fb.GetSignatureForError ());
					} else {
						Report.Error (171, loc,
							"Field `{0}' must be fully assigned before control leaves the constructor",
							TypeManager.GetFullNameSignature (field));
					}
					ok = false;
				}
			}

			return ok;
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:30,代碼來源:flowanalysis.cs

示例5: PropagateFinally

			public void PropagateFinally (UsageVector finally_vector, FlowBranching parent)
			{
				if (finally_vector != null)
					Vector.MergeChild (finally_vector, false);
				DoPropagateFinally (parent);
			}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:6,代碼來源:flowanalysis.cs

示例6: StartFlowBranching

		public FlowBranchingIterator StartFlowBranching (StateMachineInitializer iterator, FlowBranching parent)
		{
			FlowBranchingIterator branching = new FlowBranchingIterator (parent, iterator);
			current_flow_branching = branching;
			return branching;
		}
開發者ID:jkells,項目名稱:mono,代碼行數:6,代碼來源:context.cs

示例7: EndFlowBranching

		// <summary>
		//   Ends a code branching.  Merges the state of locals and parameters
		//   from all the children of the ending branching.
		// </summary>
		public bool EndFlowBranching ()
		{
			FlowBranching old = current_flow_branching;
			current_flow_branching = current_flow_branching.Parent;

			FlowBranching.UsageVector vector = current_flow_branching.MergeChild (old);
			return vector.IsUnreachable;
		}
開發者ID:KAW0,項目名稱:Alter-Native,代碼行數:12,代碼來源:context.cs

示例8: StartFlowBranching

		// <summary>
		//   Starts a new code branching.  This inherits the state of all local
		//   variables and parameters from the current branching.
		// </summary>
		public FlowBranching StartFlowBranching (FlowBranching.BranchingType type, Location loc)
		{
			current_flow_branching = FlowBranching.CreateBranching (CurrentBranching, type, null, loc);
			return current_flow_branching;
		}
開發者ID:KAW0,項目名稱:Alter-Native,代碼行數:9,代碼來源:context.cs

示例9: FlowBranchingLabeled

		public FlowBranchingLabeled (FlowBranching parent, LabeledStatement stmt)
			: base (parent, BranchingType.Labeled, SiblingType.Conditional, null, stmt.loc)
		{
			this.stmt = stmt;
			CurrentUsageVector.MergeOrigins (stmt.JumpOrigins);
			actual = CurrentUsageVector.Clone ();

			// stand-in for backward jumps
			CurrentUsageVector.ResetBarrier ();
		}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:10,代碼來源:flowanalysis.cs

示例10: FlowBranchingIterator

		public FlowBranchingIterator (FlowBranching parent, Iterator iterator)
			: base (parent, BranchingType.Iterator, SiblingType.Block, iterator.Block, iterator.Location)
		{
			this.iterator = iterator;
		}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:5,代碼來源:flowanalysis.cs

示例11: MergeChild

		public UsageVector MergeChild (FlowBranching child)
		{
			return CurrentUsageVector.MergeChild (child.Merge (), true);
 		}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:4,代碼來源:flowanalysis.cs

示例12: FlowBranchingContinuable

		public FlowBranchingContinuable (FlowBranching parent, BranchingType type, SiblingType stype, Block block, Location loc)
			: base (parent, type, stype, block, loc)
		{ }
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:3,代碼來源:flowanalysis.cs

示例13: AddUsageVector

		public void AddUsageVector (FlowBranching.UsageVector vector)
		{
			vector = vector.Clone ();
			vector.Next = vectors;
			vectors = vector;
		}
開發者ID:alisci01,項目名稱:mono,代碼行數:6,代碼來源:statement.cs

示例14: Resolve

		public bool Resolve (FlowBranching parent, BlockContext rc, IMethodData md)
		{
			if (resolved)
				return true;

			resolved = true;

			if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion))
				flags |= Flags.IsExpressionTree;

			try {
				ResolveMeta (rc);

				using (rc.With (ResolveContext.Options.DoFlowAnalysis, true)) {
					FlowBranchingToplevel top_level = rc.StartFlowBranching (this, parent);

					if (!Resolve (rc))
						return false;

					unreachable = top_level.End ();
				}
			} catch (Exception e) {
				if (e is CompletionResult || rc.Report.IsDisabled)
					throw;

				if (rc.CurrentBlock != null) {
					rc.Report.Error (584, rc.CurrentBlock.StartLocation, "Internal compiler error: {0}", e.Message);
				} else {
					rc.Report.Error (587, "Internal compiler error: {0}", e.Message);
				}

				if (Report.DebugFlags > 0)
					throw;
			}

			if (rc.ReturnType != TypeManager.void_type && !unreachable) {
				if (rc.CurrentAnonymousMethod == null) {
					// FIXME: Missing FlowAnalysis for generated iterator MoveNext method
					if (md is IteratorMethod) {
						unreachable = true;
					} else {
						rc.Report.Error (161, md.Location, "`{0}': not all code paths return a value", md.GetSignatureForError ());
						return false;
					}
				} else {
					rc.Report.Error (1643, rc.CurrentAnonymousMethod.Location, "Not all code paths return a value in anonymous method of type `{0}'",
							  rc.CurrentAnonymousMethod.GetSignatureForError ());
					return false;
				}
			}

			return true;
		}
開發者ID:alisci01,項目名稱:mono,代碼行數:53,代碼來源:statement.cs

示例15: CheckOutParameters

		// <summary>
		//   Check whether all `out' parameters have been assigned.
		// </summary>
		public void CheckOutParameters (FlowBranching.UsageVector vector, Location loc)
		{
			if (vector.IsUnreachable)
				return;

			int n = parameter_info == null ? 0 : parameter_info.Length;

			for (int i = 0; i < n; i++) {
				VariableInfo var = parameter_info[i].VariableInfo;

				if (var == null)
					continue;

				if (vector.IsAssigned (var, false))
					continue;

				TopBlock.Report.Error (177, loc, "The out parameter `{0}' must be assigned to before control leaves the current method",
					var.Name);
			}
		}
開發者ID:alisci01,項目名稱:mono,代碼行數:23,代碼來源:statement.cs


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