本文整理汇总了C#中Mono.CSharp.Block类的典型用法代码示例。如果您正苦于以下问题:C# Block类的具体用法?C# Block怎么用?C# Block使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Block类属于Mono.CSharp命名空间,在下文中一共展示了Block类的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: RemapBlockCopy
///
/// Remaps block to cloned copy if one exists.
///
public Block RemapBlockCopy (Block from)
{
Block mapped_to;
if (!block_map.TryGetValue (from, out mapped_to))
return from;
return mapped_to;
}
示例4: AddBlockMap
public void AddBlockMap (Block from, Block to)
{
block_map.Add (from, to);
}
示例5: AddBlockChildren
void AddBlockChildren (BlockStatement result, Block blockStatement, List<LocalInfo> localVariables, ref int curLocal)
{
foreach (Statement stmt in blockStatement.Statements) {
if (stmt == null)
continue;
if (curLocal < localVariables.Count && IsLower (localVariables[curLocal].Location, stmt.loc)) {
result.AddChild (CreateVariableDeclaration (localVariables[curLocal]), AbstractCSharpNode.Roles.Statement);
curLocal++;
}
if (stmt is Block && !(stmt is ToplevelBlock || stmt is ExplicitBlock)) {
AddBlockChildren (result, (Block)stmt, localVariables, ref curLocal);
} else {
result.AddChild ((INode)stmt.Accept (this), AbstractCSharpNode.Roles.Statement);
}
}
}
示例6: Visit
public override object Visit (Block blockStatement)
{
if (blockStatement.IsGenerated) {
if (blockStatement.Statements.First () is Using)
return CreateUsingStatement (blockStatement);
return blockStatement.Statements.Last ().Accept (this);
}
var result = new BlockStatement ();
result.AddChild (new CSharpTokenNode (Convert (blockStatement.StartLocation), 1), AbstractCSharpNode.Roles.LBrace);
int curLocal = 0;
List<LocalInfo> localVariables = new List<LocalInfo> (blockStatement.Variables.Values);
AddBlockChildren (result, blockStatement, localVariables, ref curLocal);
while (curLocal < localVariables.Count) {
result.AddChild (CreateVariableDeclaration (localVariables[curLocal]), AbstractCSharpNode.Roles.Statement);
curLocal++;
}
result.AddChild (new CSharpTokenNode (Convert (blockStatement.EndLocation), 1), AbstractCSharpNode.Roles.RBrace);
return result;
}
示例7: AddBlockChildren
void AddBlockChildren(BlockStatement result, Block blockStatement, ref int curLocal)
{
if (convertTypeSystemMode) {
return;
}
foreach (Mono.CSharp.Statement stmt in blockStatement.Statements) {
if (stmt == null)
continue;
/* if (curLocal < localVariables.Count && IsLower (localVariables[curLocal].Location, stmt.loc)) {
result.AddChild (CreateVariableDeclaration (localVariables[curLocal]), Roles.Statement);
curLocal++;
}*/
if (stmt is Block && !(stmt is ToplevelBlock || stmt is ExplicitBlock)) {
AddBlockChildren(result, (Block)stmt, ref curLocal);
} else {
result.AddChild((Statement)stmt.Accept(this), BlockStatement.StatementRole);
}
}
}
示例8: EmitMoveNext_NoResumePoints
void EmitMoveNext_NoResumePoints(EmitContext ec, Block original_block)
{
ec.Emit (OpCodes.Ldarg_0);
ec.Emit (OpCodes.Ldfld, IteratorHost.PC.Spec);
ec.Emit (OpCodes.Ldarg_0);
ec.EmitInt ((int) State.After);
ec.Emit (OpCodes.Stfld, IteratorHost.PC.Spec);
// We only care if the PC is zero (start executing) or non-zero (don't do anything)
ec.Emit (OpCodes.Brtrue, move_next_error);
SymbolWriter.StartIteratorBody (ec);
original_block.Emit (ec);
SymbolWriter.EndIteratorBody (ec);
ec.MarkLabel (move_next_error);
ec.Emit (OpCodes.Ldc_I4_0);
ec.Emit (OpCodes.Ret);
}
示例9: case_978
void case_978()
#line 6605 "cs-parser.jay"
{
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
current_block = new Linq.QueryBlock (current_block, lexer.Location);
linq_clause_blocks.Push ((Linq.QueryBlock) current_block);
}
示例10: case_977
void case_977()
#line 6597 "cs-parser.jay"
{
if (linq_clause_blocks == null)
linq_clause_blocks = new Stack<Linq.QueryBlock> ();
current_block = new Linq.QueryBlock (current_block, lexer.Location);
linq_clause_blocks.Push ((Linq.QueryBlock) current_block);
}
示例11: case_976
void case_976()
#line 6587 "cs-parser.jay"
{
yyVal = new Linq.Where ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
}
示例12: case_974
void case_974()
#line 6568 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-3+yyTop];
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
yyVal = new Linq.Let ((Linq.QueryBlock) current_block, sn, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
((Linq.QueryBlock)current_block).AddRangeVariable (sn);
}
示例13: case_963
void case_963()
#line 6522 "cs-parser.jay"
{
var obj = (object[]) yyVals[0+yyTop];
yyVal = new Linq.GroupBy ((Linq.QueryBlock)current_block, (Expression)yyVals[-2+yyTop], linq_clause_blocks.Pop (), (Expression)obj[0], GetLocation (yyVals[-4+yyTop]));
lbag.AddLocation (yyVal, (Location) obj[1]);
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
}
示例14: case_962
void case_962()
#line 6515 "cs-parser.jay"
{
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
current_block = new Linq.QueryBlock (current_block, lexer.Location);
}
示例15: case_953
void case_953()
#line 6436 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-3+yyTop];
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
yyVal = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-5+yyTop])) {
IdentifierType = (FullNamedExpression)yyVals[-4+yyTop]
};
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
((Linq.QueryBlock)current_block).AddRangeVariable (sn);
lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]));
}