本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.Node.ReplaceBy方法的典型用法代码示例。如果您正苦于以下问题:C# Node.ReplaceBy方法的具体用法?C# Node.ReplaceBy怎么用?C# Node.ReplaceBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Galaxy_Editor_2.Compiler.Generated.node.Node
的用法示例。
在下文中一共展示了Node.ReplaceBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultIn
public override void DefaultIn(Node node)
{
//
int index = 0;
GetChildTypeIndex getChildTypeIndex = new GetChildTypeIndex() { Parent = node.Parent(), Child = node };
node.Parent().Apply(getChildTypeIndex);
index = getChildTypeIndex.Index;
GetChildTypeByIndex getChildTypeByIndex = new GetChildTypeByIndex() { Child = node, Index = index, Parent = currentCloneNode };
currentCloneNode.Apply(getChildTypeByIndex);
currentCloneNode = getChildTypeByIndex.Child;
//currentCloneNode should now be the clone corrosponding to node.
/*finalTrans.data.ExpTypes
finalTrans.data.FieldLinks
finalTrans.data.LocalLinks
finalTrans.data.Locals//Lets not forget about this one
finalTrans.data.LvalueTypes
finalTrans.data.SimpleMethodLinks
finalTrans.data.StructFieldLinks
finalTrans.data.StructMethodLinks
finalTrans.data.StructTypeLinks*/
if (node is AABlock)
data.Locals[(AABlock) currentCloneNode] = new List<AALocalDecl>();
if (node is PExp)
data.ExpTypes[(PExp)currentCloneNode] = data.ExpTypes[(PExp)node];
if (node is AFieldLvalue)
data.FieldLinks[(AFieldLvalue)currentCloneNode] = data.FieldLinks[(AFieldLvalue)node];
if (node is ALocalLvalue)
{
PLvalue replacer = Util.MakeClone(localMap[data.LocalLinks[(ALocalLvalue)node]],
data);
currentCloneNode.ReplaceBy(replacer);
currentCloneNode = replacer;
}
if (node is AALocalDecl)
{
ALocalLvalue replacer = new ALocalLvalue(new TIdentifier("IwillGetRenamedLater"));
data.LvalueTypes[replacer] = ((AALocalDecl)currentCloneNode).GetType();
data.LocalLinks[replacer] = (AALocalDecl)currentCloneNode;
AABlock pBlock = Util.GetAncestor<AABlock>(currentCloneNode) ??
(AABlock) Util.GetAncestor<AMethodDecl>(currentCloneNode).GetBlock();
data.Locals[Util.GetAncestor<AABlock>(currentCloneNode)].Add((AALocalDecl) currentCloneNode);
localMap.Add((AALocalDecl)node, replacer);
}
if (node is PLvalue)
data.LvalueTypes[(PLvalue)currentCloneNode] = data.LvalueTypes[(PLvalue)node];
if (node is ASimpleInvokeExp)
data.SimpleMethodLinks[(ASimpleInvokeExp)currentCloneNode] = data.SimpleMethodLinks[(ASimpleInvokeExp)node];
if (node is AStructLvalue)
data.StructFieldLinks[(AStructLvalue)currentCloneNode] = data.StructFieldLinks[(AStructLvalue)node];
if (node is ANonstaticInvokeExp)
data.StructMethodLinks[(ANonstaticInvokeExp)currentCloneNode] = data.StructMethodLinks[(ANonstaticInvokeExp)node];
if (node is ANamedType && data.StructTypeLinks.Keys.Contains(node))
data.StructTypeLinks[(ANamedType)currentCloneNode] = data.StructTypeLinks[(ANamedType)node];
if (extraCheck != null)
extraCheck(node, currentCloneNode);
if (node is PType && data.EnrichmentTypeLinks.ContainsKey((PType) node))
data.EnrichmentTypeLinks[(PType)currentCloneNode] = data.EnrichmentTypeLinks[(PType)node];
if (node is AStringConstExp)
{
if (data.StringsDontJoinRight.Contains(node))
data.StringsDontJoinRight.Add((AStringConstExp) currentCloneNode);
}
}
示例2: DefaultIn
public override void DefaultIn(Node node)
{
//
int index = 0;
GetChildTypeIndex getChildTypeIndex = new GetChildTypeIndex() { Parent = node.Parent(), Child = node };
node.Parent().Apply(getChildTypeIndex);
index = getChildTypeIndex.Index;
GetChildTypeByIndex getChildTypeByIndex = new GetChildTypeByIndex() { Child = node, Index = index, Parent = currentCloneNode };
currentCloneNode.Apply(getChildTypeByIndex);
currentCloneNode = getChildTypeByIndex.Child;
//currentCloneNode should now be the clone corrosponding to node.
/*finalTrans.data.ExpTypes
finalTrans.data.FieldLinks
finalTrans.data.LocalLinks
finalTrans.data.Locals//Lets forget about this one
finalTrans.data.LvalueTypes
finalTrans.data.SimpleMethodLinks
finalTrans.data.StructFieldLinks
finalTrans.data.StructMethodLinks
finalTrans.data.StructTypeLinks*/
if (node is ANewExp && finalTrans.data.ConstructorLinks.ContainsKey((ANewExp)node))
finalTrans.data.ConstructorLinks[(ANewExp) currentCloneNode] = finalTrans.data.ConstructorLinks[(ANewExp) node];
if (node is PExp)
finalTrans.data.ExpTypes[(PExp)currentCloneNode] = finalTrans.data.ExpTypes[(PExp)node];
if (node is AStringConstExp && finalTrans.data.TriggerDeclarations.Any(p => p.Value.Contains(((AStringConstExp)node).GetStringLiteral())))
finalTrans.data.TriggerDeclarations.First(
p => p.Value.Contains(((AStringConstExp) node).GetStringLiteral())).Value.Add(
((AStringConstExp) currentCloneNode).GetStringLiteral());
if (node is AFieldLvalue)
finalTrans.data.FieldLinks[(AFieldLvalue)currentCloneNode] = finalTrans.data.FieldLinks[(AFieldLvalue)node];
if (node is ALocalLvalue)
{
AALocalDecl originalFormal = finalTrans.data.LocalLinks[(ALocalLvalue) node];
PLvalue replacer = Util.MakeClone(localMap[originalFormal],
finalTrans.data);
currentCloneNode.ReplaceBy(replacer);
currentCloneNode = replacer;
if (localExpMap.ContainsKey(originalFormal))
{
ReplaceUsAfter[replacer] = localExpMap[originalFormal];
}
}
if (node is AALocalDecl)
{
ALocalLvalue replacer = new ALocalLvalue(new TIdentifier("IwillGetRenamedLater"));
finalTrans.data.LvalueTypes[replacer] = ((AALocalDecl) currentCloneNode).GetType();
finalTrans.data.LocalLinks[replacer] = (AALocalDecl)currentCloneNode;
localMap.Add((AALocalDecl)node, replacer);
}
if (node is PLvalue)
finalTrans.data.LvalueTypes[(PLvalue)currentCloneNode] = finalTrans.data.LvalueTypes[(PLvalue)node];
if (node is ASimpleInvokeExp)
finalTrans.data.SimpleMethodLinks[(ASimpleInvokeExp)currentCloneNode] = finalTrans.data.SimpleMethodLinks[(ASimpleInvokeExp)node];
if (node is AStructLvalue)
finalTrans.data.StructFieldLinks[(AStructLvalue)currentCloneNode] = finalTrans.data.StructFieldLinks[(AStructLvalue)node];
if (node is ANonstaticInvokeExp)
finalTrans.data.StructMethodLinks[(ANonstaticInvokeExp)currentCloneNode] = finalTrans.data.StructMethodLinks[(ANonstaticInvokeExp)node];
if (node is ANamedType && finalTrans.data.StructTypeLinks.Keys.Contains(node))
finalTrans.data.StructTypeLinks[(ANamedType)currentCloneNode] = finalTrans.data.StructTypeLinks[(ANamedType)node];
if (node is ANamedType && finalTrans.data.DelegateTypeLinks.Keys.Contains(node))
finalTrans.data.DelegateTypeLinks[(ANamedType)currentCloneNode] = finalTrans.data.DelegateTypeLinks[(ANamedType)node];
if (node is APropertyLvalue && finalTrans.data.PropertyLinks.ContainsKey((APropertyLvalue)node))
finalTrans.data.PropertyLinks[(APropertyLvalue) currentCloneNode] = finalTrans.data.PropertyLinks[(APropertyLvalue) node];
}