本文整理匯總了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
//
}