private BoundBlock BuildBlock(BoundStatement node) { var block = node as BoundBlock; if (block != null) return block; var builder = new BlockBuilder(this); builder.Add(node); return builder.BuildBlock(node.Location); }
internal void Add(BoundStatement node) { if (_nodes == null) _nodes = new ReadOnlyArray<BoundStatement>.Builder(); var block = node as BoundBlock; if (block != null && block.Nodes.Count == 1 && block.Location == SourceLocation.Missing) _nodes.Add(block.Nodes[0]); else _nodes.Add(node); }
private void EmitStatement(BoundStatement node) { IL.MarkSequencePoint(node.Location); switch (node.Kind) { case BoundKind.Block: EmitStatements((BoundBlock)node); return; case BoundKind.Break: EmitBreak((BoundBreak)node); return; case BoundKind.Continue: EmitContinue((BoundContinue)node); return; case BoundKind.DoWhile: EmitDoWhile((BoundDoWhile)node); return; case BoundKind.Empty: return; case BoundKind.ExpressionStatement: EmitExpressionStatement((BoundExpressionStatement)node); return; case BoundKind.For: EmitFor((BoundFor)node); return; case BoundKind.ForEachIn: EmitForEachIn((BoundForEachIn)node); return; case BoundKind.If: EmitIf((BoundIf)node); return; case BoundKind.Label: EmitLabel((BoundLabel)node); return; case BoundKind.Return: EmitReturn((BoundReturn)node); return; case BoundKind.SetAccessor: EmitSetAccessor((BoundSetAccessor)node); return; case BoundKind.SetMember: EmitSetMember((BoundSetMember)node); return; case BoundKind.SetVariable: EmitSetVariable((BoundSetVariable)node); return; case BoundKind.Switch: EmitSwitch((BoundSwitch)node); return; case BoundKind.Throw: EmitThrow((BoundThrow)node); return; case BoundKind.Try: EmitTry((BoundTry)node); return; case BoundKind.While: EmitWhile((BoundWhile)node); return; default: throw new InvalidOperationException(); } }