当前位置: 首页>>代码示例>>C#>>正文


C# Node.ReplaceBy方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:64,代码来源:CloneMethod.cs

示例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];
            }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:70,代码来源:FixInlineMethods.cs


注:本文中的Galaxy_Editor_2.Compiler.Generated.node.Node.ReplaceBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。