本文整理汇总了C#中Boo.Lang.Compiler.Ast.Block.Simplify方法的典型用法代码示例。如果您正苦于以下问题:C# Block.Simplify方法的具体用法?C# Block.Simplify怎么用?C# Block.Simplify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.Block
的用法示例。
在下文中一共展示了Block.Simplify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Expand
public Statement Expand(IEnumerable<Node> generator)
{
Block resultingBlock = new Block();
foreach (Node node in generator)
{
//'yield' (ie. implicit 'yield null') means 'yield `macro`.Body'
Node generatedNode = node ?? _node.Body;
if (null == generatedNode)
continue;
TypeMember member = generatedNode as TypeMember;
if (null != member)
{
ExpandTypeMember(member, resultingBlock);
continue;
}
Block block = generatedNode as Block;
if (null != block)
{
resultingBlock.Add(block);
continue;
}
Statement statement = generatedNode as Statement;
if (null != statement)
{
resultingBlock.Add(statement);
continue;
}
Expression expression = generatedNode as Expression;
if (null != expression)
{
resultingBlock.Add(expression);
continue;
}
Import import = generatedNode as Import;
if (null != import)
{
ExpandImport(import);
continue;
}
throw new CompilerError(_node, "Unsupported expansion: " + generatedNode.ToCodeString());
}
return resultingBlock.IsEmpty
? null
: resultingBlock.Simplify();
}