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];
                }
            }
Exemple #2
0
        public override void DefaultIn(Node node)
        {
            if (!canMerge)
            {
                return;
            }
            if (node is AMethodDecl)
            {
                //First node - no need to fetch
                if (((AMethodDecl)node).GetFormals().Count != ((AMethodDecl)otherNode).GetFormals().Count)
                {
                    canMerge = false;
                }
                return;
            }
            //Fetch corrosponding other 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 = otherNode
            };

            otherNode.Apply(getChildTypeByIndex);
            otherNode = getChildTypeByIndex.Child;

            if (otherNode.GetType() != node.GetType())
            {
                canMerge = false;
                return;
            }

            if (node is AALocalDecl)
            {
                locals.Add((AALocalDecl)node);
                otherLocals.Add((AALocalDecl)otherNode);
                return;
            }

            if (node is ANamedType)
            {
                ANamedType aNode  = (ANamedType)node;
                ANamedType aOther = (ANamedType)otherNode;
                if (data.StructTypeLinks.ContainsKey(aNode) != data.StructTypeLinks.ContainsKey(aOther))
                {
                    canMerge = false;
                    return;
                }
                if (data.StructTypeLinks.ContainsKey(aNode) && data.StructTypeLinks[aNode] != data.StructTypeLinks[aOther])
                {
                    canMerge = false;
                }
                if (!data.StructTypeLinks.ContainsKey(aNode) && aNode.IsSame(aOther, true))//aNode.GetName().Text != aOther.GetName().Text)
                {
                    canMerge = false;
                }
                if (aNode.IsPrimitive() && !aOther.IsPrimitive(aNode.AsIdentifierString()))
                {
                    canMerge = false;
                }
                return;
            }

            if (node is AABlock)
            {
                AABlock aNode  = (AABlock)node;
                AABlock aOther = (AABlock)otherNode;
                if (aNode.GetStatements().Count != aOther.GetStatements().Count)
                {
                    canMerge = false;
                }
                return;
            }

            if (node is AIntConstExp)
            {
                AIntConstExp aNode  = (AIntConstExp)node;
                AIntConstExp aOther = (AIntConstExp)otherNode;
                if (aNode.GetIntegerLiteral().Text != aOther.GetIntegerLiteral().Text)
                {
                    canMerge = false;
                }
                return;
            }

            if (node is AFixedConstExp)
            {
                AFixedConstExp aNode  = (AFixedConstExp)node;
                AFixedConstExp aOther = (AFixedConstExp)otherNode;
                if (aNode.GetFixedLiteral().Text != aOther.GetFixedLiteral().Text)
                {
                    canMerge = false;
                }
                return;
            }

            if (node is AStringConstExp)
            {
                AStringConstExp aNode  = (AStringConstExp)node;
                AStringConstExp aOther = (AStringConstExp)otherNode;
                if (aNode.GetStringLiteral().Text != aOther.GetStringLiteral().Text)
                {
                    canMerge = false;
                }
                return;
            }

            if (node is ACharConstExp)
            {
                ACharConstExp aNode  = (ACharConstExp)node;
                ACharConstExp aOther = (ACharConstExp)otherNode;
                if (aNode.GetCharLiteral().Text != aOther.GetCharLiteral().Text)
                {
                    canMerge = false;
                }
                return;
            }

            if (node is ASimpleInvokeExp)
            {
                ASimpleInvokeExp aNode  = (ASimpleInvokeExp)node;
                ASimpleInvokeExp aOther = (ASimpleInvokeExp)otherNode;
                if (data.SimpleMethodLinks[aNode] != data.SimpleMethodLinks[aOther] &&
                    !(data.SimpleMethodLinks[aNode] == Util.GetAncestor <AMethodDecl>(aNode) &&
                      data.SimpleMethodLinks[aOther] == Util.GetAncestor <AMethodDecl>(aOther)))
                {
                    canMerge = false;
                }
                return;
            }

            if (node is ALocalLvalue)
            {
                ALocalLvalue aNode  = (ALocalLvalue)node;
                ALocalLvalue aOther = (ALocalLvalue)otherNode;
                if (locals.IndexOf(data.LocalLinks[aNode]) != otherLocals.IndexOf(data.LocalLinks[aOther]))
                {
                    canMerge = false;
                }
                return;
            }

            if (node is AFieldLvalue)
            {
                AFieldLvalue aNode  = (AFieldLvalue)node;
                AFieldLvalue aOther = (AFieldLvalue)otherNode;
                if (data.FieldLinks[aNode] != data.FieldLinks[aOther])
                {
                    canMerge = false;
                }
                return;
            }

            if (node is AStructLvalue)
            {
                AStructLvalue aNode  = (AStructLvalue)node;
                AStructLvalue aOther = (AStructLvalue)otherNode;
                if (data.StructFieldLinks[aNode] != data.StructFieldLinks[aOther])
                {
                    canMerge = false;
                }
                return;
            }
        }
        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);
            }
        }
Exemple #4
0
        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);
                }
            }
        }
            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];
            }
        public override void DefaultIn(Node node)
        {
            if (!canMerge)
                return;
            if (node is AMethodDecl)
            {
                //First node - no need to fetch
                if (((AMethodDecl)node).GetFormals().Count != ((AMethodDecl)otherNode).GetFormals().Count)
                {
                    canMerge = false;
                }
                return;
            }
            //Fetch corrosponding other 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 = otherNode };
            otherNode.Apply(getChildTypeByIndex);
            otherNode = getChildTypeByIndex.Child;

            if (otherNode.GetType() != node.GetType())
            {
                canMerge = false;
                return;
            }

            if (node is AALocalDecl)
            {
                locals.Add((AALocalDecl) node);
                otherLocals.Add((AALocalDecl) otherNode);
                return;
            }

            if (node is ANamedType)
            {
                ANamedType aNode = (ANamedType) node;
                ANamedType aOther = (ANamedType) otherNode;
                if (data.StructTypeLinks.ContainsKey(aNode) != data.StructTypeLinks.ContainsKey(aOther))
                {
                    canMerge = false;
                    return;
                }
                if (data.StructTypeLinks.ContainsKey(aNode) && data.StructTypeLinks[aNode] != data.StructTypeLinks[aOther])
                {
                    canMerge = false;
                }
                if (!data.StructTypeLinks.ContainsKey(aNode) && aNode.IsSame(aOther, true))//aNode.GetName().Text != aOther.GetName().Text)
                    canMerge = false;
                if (aNode.IsPrimitive() && !aOther.IsPrimitive(aNode.AsIdentifierString()))
                    canMerge = false;
                return;
            }

            if (node is AABlock)
            {
                AABlock aNode = (AABlock)node;
                AABlock aOther = (AABlock)otherNode;
                if (aNode.GetStatements().Count != aOther.GetStatements().Count)
                    canMerge = false;
                return;
            }

            if (node is AIntConstExp)
            {
                AIntConstExp aNode = (AIntConstExp)node;
                AIntConstExp aOther = (AIntConstExp)otherNode;
                if (aNode.GetIntegerLiteral().Text != aOther.GetIntegerLiteral().Text)
                    canMerge = false;
                return;
            }

            if (node is AFixedConstExp)
            {
                AFixedConstExp aNode = (AFixedConstExp)node;
                AFixedConstExp aOther = (AFixedConstExp)otherNode;
                if (aNode.GetFixedLiteral().Text != aOther.GetFixedLiteral().Text)
                    canMerge = false;
                return;
            }

            if (node is AStringConstExp)
            {
                AStringConstExp aNode = (AStringConstExp)node;
                AStringConstExp aOther = (AStringConstExp)otherNode;
                if (aNode.GetStringLiteral().Text != aOther.GetStringLiteral().Text)
                    canMerge = false;
                return;
            }

            if (node is ACharConstExp)
            {
                ACharConstExp aNode = (ACharConstExp)node;
                ACharConstExp aOther = (ACharConstExp)otherNode;
                if (aNode.GetCharLiteral().Text != aOther.GetCharLiteral().Text)
                    canMerge = false;
                return;
            }

            if (node is ASimpleInvokeExp)
            {
                ASimpleInvokeExp aNode = (ASimpleInvokeExp)node;
                ASimpleInvokeExp aOther = (ASimpleInvokeExp)otherNode;
                if (data.SimpleMethodLinks[aNode] != data.SimpleMethodLinks[aOther] &&
                    !(data.SimpleMethodLinks[aNode] == Util.GetAncestor<AMethodDecl>(aNode) &&
                        data.SimpleMethodLinks[aOther] == Util.GetAncestor<AMethodDecl>(aOther)))
                    canMerge = false;
                return;
            }

            if (node is ALocalLvalue)
            {
                ALocalLvalue aNode = (ALocalLvalue)node;
                ALocalLvalue aOther = (ALocalLvalue)otherNode;
                if (locals.IndexOf(data.LocalLinks[aNode]) != otherLocals.IndexOf(data.LocalLinks[aOther]))
                    canMerge = false;
                return;
            }

            if (node is AFieldLvalue)
            {
                AFieldLvalue aNode = (AFieldLvalue)node;
                AFieldLvalue aOther = (AFieldLvalue)otherNode;
                if (data.FieldLinks[aNode] != data.FieldLinks[aOther])
                    canMerge = false;
                return;
            }

            if (node is AStructLvalue)
            {
                AStructLvalue aNode = (AStructLvalue)node;
                AStructLvalue aOther = (AStructLvalue)otherNode;
                if (data.StructFieldLinks[aNode] != data.StructFieldLinks[aOther])
                    canMerge = false;
                return;
            }
        }