本文整理汇总了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);
}
}
示例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);
}
示例3: DoPropagateFinally
protected override void DoPropagateFinally (FlowBranching parent)
{
parent.AddContinueOrigin (Vector, Loc);
}
示例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;
}
示例5: PropagateFinally
public void PropagateFinally (UsageVector finally_vector, FlowBranching parent)
{
if (finally_vector != null)
Vector.MergeChild (finally_vector, false);
DoPropagateFinally (parent);
}
示例6: StartFlowBranching
public FlowBranchingIterator StartFlowBranching (StateMachineInitializer iterator, FlowBranching parent)
{
FlowBranchingIterator branching = new FlowBranchingIterator (parent, iterator);
current_flow_branching = branching;
return branching;
}
示例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;
}
示例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;
}
示例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 ();
}
示例10: FlowBranchingIterator
public FlowBranchingIterator (FlowBranching parent, Iterator iterator)
: base (parent, BranchingType.Iterator, SiblingType.Block, iterator.Block, iterator.Location)
{
this.iterator = iterator;
}
示例11: MergeChild
public UsageVector MergeChild (FlowBranching child)
{
return CurrentUsageVector.MergeChild (child.Merge (), true);
}
示例12: FlowBranchingContinuable
public FlowBranchingContinuable (FlowBranching parent, BranchingType type, SiblingType stype, Block block, Location loc)
: base (parent, type, stype, block, loc)
{ }
示例13: AddUsageVector
public void AddUsageVector (FlowBranching.UsageVector vector)
{
vector = vector.Clone ();
vector.Next = vectors;
vectors = vector;
}
示例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;
}
示例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);
}
}