本文整理汇总了C#中Mono.CSharp.CloneContext.AddBlockMap方法的典型用法代码示例。如果您正苦于以下问题:C# CloneContext.AddBlockMap方法的具体用法?C# CloneContext.AddBlockMap怎么用?C# CloneContext.AddBlockMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.CloneContext
的用法示例。
在下文中一共展示了CloneContext.AddBlockMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloneTo
protected override void CloneTo (CloneContext clonectx, Statement t)
{
Block target = (Block) t;
#if DEBUG
target.clone_id = clone_id_counter++;
#endif
clonectx.AddBlockMap (this, target);
target.ParametersBlock = (ParametersBlock) (ParametersBlock == this ? target : clonectx.RemapBlockCopy (ParametersBlock));
target.Explicit = (ExplicitBlock) (Explicit == this ? target : clonectx.LookupBlock (Explicit));
if (Parent != null)
target.Parent = clonectx.RemapBlockCopy (Parent);
target.statements = new List<Statement> (statements.Count);
foreach (Statement s in statements)
target.statements.Add (s.Clone (clonectx));
}
示例2: CloneTo
protected override void CloneTo (CloneContext clonectx, Statement t)
{
Block target = (Block) t;
clonectx.AddBlockMap (this, target);
target.Toplevel = (ToplevelBlock) clonectx.LookupBlock (Toplevel);
target.Explicit = (ExplicitBlock) clonectx.LookupBlock (Explicit);
if (Parent != null)
target.Parent = clonectx.RemapBlockCopy (Parent);
if (variables != null){
target.variables = new Dictionary<string, LocalInfo> ();
foreach (var de in variables){
LocalInfo newlocal = de.Value.Clone (clonectx);
target.variables [de.Key] = newlocal;
clonectx.AddVariableMap (de.Value, newlocal);
}
}
target.statements = new List<Statement> (statements.Count);
foreach (Statement s in statements)
target.statements.Add (s.Clone (clonectx));
if (target.children != null){
target.children = new List<Block> (children.Count);
foreach (Block b in children){
target.children.Add (clonectx.LookupBlock (b));
}
}
//
// TODO: labels, switch_block, constants (?), anonymous_children
//
}