public override void DefaultOut(Node node) { if (node is PType) { Link((PType) node, node); } else if (node is PExp) { Link(data.ExpTypes[(PExp) node], node); } else if (node is PLvalue && !(node.Parent() is ASyncInvokeExp || node.Parent() is AAsyncInvokeStm)) { Link(data.LvalueTypes[(PLvalue)node], node); } base.DefaultOut(node); }
private static PStm GetNext(PStm stm) { while (true) { AABlock pBlock = Util.GetAncestor <AABlock>(stm); if (pBlock == null) { return(null); } int index = pBlock.GetStatements().IndexOf(stm); while (index < pBlock.GetStatements().Count - 1) { stm = GetFirst((PStm)pBlock.GetStatements()[index + 1]); if (stm != null) { return(stm); } index++; } ASTNode node = pBlock; stm = null; while (true) { if (node == null) { return(null); } node = Util.GetNearestAncestor(node.Parent(), typeof(AABlock), typeof(PStm)); if (node is PStm) { stm = (PStm)node; } else if (stm == null) { continue; } else { break; } } //stm = Util.GetAncestor<PStm>(pBlock); if (stm == null) { return(null); } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_const_ == oldChild) { SetConst((TConst)newChild); return; } for (int i = 0; i < _pre_pointers_.Count; i++) { Node n = (Node)_pre_pointers_[i]; if (n == oldChild) { if (newChild != null) { _pre_pointers_[i] = newChild; oldChild.Parent(null); return; } _pre_pointers_.RemoveAt(i); oldChild.Parent(null); return; } } if (_lvalue_ == oldChild) { SetLvalue((PLvalue)newChild); return; } if (_generic_token_ == oldChild) { SetGenericToken((TLt)newChild); return; } for (int i = 0; i < _generic_types_.Count; i++) { Node n = (Node)_generic_types_[i]; if (n == oldChild) { if (newChild != null) { _generic_types_[i] = newChild; oldChild.Parent(null); return; } _generic_types_.RemoveAt(i); oldChild.Parent(null); return; } } for (int i = 0; i < _post_pointers_.Count; i++) { Node n = (Node)_post_pointers_[i]; if (n == oldChild) { if (newChild != null) { _post_pointers_[i] = newChild; oldChild.Parent(null); return; } _post_pointers_.RemoveAt(i); oldChild.Parent(null); return; } } for (int i = 0; i < _local_decl_right_.Count; i++) { Node n = (Node)_local_decl_right_[i]; if (n == oldChild) { if (newChild != null) { _local_decl_right_[i] = newChild; oldChild.Parent(null); return; } _local_decl_right_.RemoveAt(i); oldChild.Parent(null); 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 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]; }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_token_ == oldChild) { SetToken((TLt)newChild); return; } if (_base_ == oldChild) { SetBase((PType)newChild); return; } for (int i = 0; i < _generic_types_.Count; i++) { Node n = (Node)_generic_types_[i]; if (n == oldChild) { if (newChild != null) { _generic_types_[i] = newChild; oldChild.Parent(null); return; } _generic_types_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_token_ == oldChild) { SetToken((TEnrichment)newChild); return; } if (_dimention_ == oldChild) { SetDimention((PExp)newChild); return; } if (_int_dim_ == oldChild) { SetIntDim((TIntegerLiteral)newChild); return; } if (_end_token_ == oldChild) { SetEndToken((TRBrace)newChild); return; } if (_type_ == oldChild) { SetType((PType)newChild); return; } for (int i = 0; i < _decl_.Count; i++) { Node n = (Node)_decl_[i]; if (n == oldChild) { if (newChild != null) { _decl_[i] = newChild; oldChild.Parent(null); return; } _decl_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_visibility_modifier_ == oldChild) { SetVisibilityModifier((PVisibilityModifier)newChild); return; } if (_name_ == oldChild) { SetName((TIdentifier)newChild); return; } for (int i = 0; i < _formals_.Count; i++) { Node n = (Node)_formals_[i]; if (n == oldChild) { if (newChild != null) { _formals_[i] = newChild; oldChild.Parent(null); return; } _formals_.RemoveAt(i); oldChild.Parent(null); return; } } if (_block_ == oldChild) { SetBlock((PBlock)newChild); return; } }
internal override void ReplaceChild(Node oldChild, Node newChild) { for (int i = 0; i < _decl_.Count; i++) { Node n = (Node)_decl_[i]; if (n == oldChild) { if (newChild != null) { _decl_[i] = newChild; oldChild.Parent(null); return; } _decl_.RemoveAt(i); oldChild.Parent(null); return; } } if (_name_ == oldChild) { SetName((TIdentifier)newChild); return; } for (int i = 0; i < _usings_.Count; i++) { Node n = (Node)_usings_[i]; if (n == oldChild) { if (newChild != null) { _usings_[i] = newChild; oldChild.Parent(null); return; } _usings_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_token_ == oldChild) { SetToken((TNamespace)newChild); return; } for (int i = 0; i < _name_.Count; i++) { Node n = (Node)_name_[i]; if (n == oldChild) { if (newChild != null) { _name_[i] = newChild; oldChild.Parent(null); return; } _name_.RemoveAt(i); oldChild.Parent(null); return; } } for (int i = 0; i < _decl_.Count; i++) { Node n = (Node)_decl_[i]; if (n == oldChild) { if (newChild != null) { _decl_[i] = newChild; oldChild.Parent(null); return; } _decl_.RemoveAt(i); oldChild.Parent(null); return; } } if (_end_token_ == oldChild) { SetEndToken((TRBrace)newChild); return; } }
public override void DefaultIn(Node node) { if (node is PExp) { PExp exp = (PExp) node; if (finalTrans.data.ExpTypes[exp] is ANamedType) { ANamedType type = (ANamedType) finalTrans.data.ExpTypes[exp]; if (finalTrans.data.StructTypeLinks.ContainsKey(type)) { AStructDecl strDecl = finalTrans.data.StructTypeLinks[type]; if (strDecl.GetLocals().Cast<PLocalDecl>().Select(decl => decl is AALocalDecl).Count() == 0) { if (node.Parent() is AAssignmentExp) node = node.Parent().Parent(); MoveMethodDeclsOut mover = new MoveMethodDeclsOut("removedStructVar", finalTrans.data); node.Apply(mover); foreach (PStm pStm in mover.NewStatements) { pStm.Apply(this); } node.Parent().RemoveChild(node); if (node.Parent() is ABinopExp) { ABinopExp parent = (ABinopExp) node.Parent(); ABooleanConstExp replacer; if (parent.GetBinop() is ANeBinop || parent.GetBinop() is AGtBinop || parent.GetBinop() is ALtBinop) replacer = new ABooleanConstExp(new AFalseBool()); else replacer = new ABooleanConstExp(new ATrueBool()); finalTrans.data.ExpTypes[replacer] = new ANamedType(new TIdentifier("bool"), null); parent.ReplaceBy(replacer); } } } } } }
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) { if (node == Parent) return; if (node.Parent() != Parent) return; if (node == Child) indexFound = true; if (indexFound) return; if (node.GetType() == Child.GetType()) Index++; }
public override void DefaultIn(Node node) { if (node == Parent) return; if (node.Parent() != Parent) return; if (childFound) return; if (Child.GetType() == node.GetType()) { if (index == Index) { Child = node; childFound = true; } else index++; } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_visibility_modifier_ == oldChild) { SetVisibilityModifier((PVisibilityModifier)newChild); return; } if (_class_token_ == oldChild) { SetClassToken((TClassToken)newChild); return; } if (_dimention_ == oldChild) { SetDimention((PExp)newChild); return; } if (_int_dim_ == oldChild) { SetIntDim((TIntegerLiteral)newChild); return; } if (_end_token_ == oldChild) { SetEndToken((TRBrace)newChild); return; } if (_name_ == oldChild) { SetName((TIdentifier)newChild); return; } for (int i = 0; i < _generic_vars_.Count; i++) { Node n = (Node)_generic_vars_[i]; if (n == oldChild) { if (newChild != null) { _generic_vars_[i] = newChild; oldChild.Parent(null); return; } _generic_vars_.RemoveAt(i); oldChild.Parent(null); return; } } if (_base_ == oldChild) { SetBase((PType)newChild); return; } for (int i = 0; i < _locals_.Count; i++) { Node n = (Node)_locals_[i]; if (n == oldChild) { if (newChild != null) { _locals_[i] = newChild; oldChild.Parent(null); return; } _locals_.RemoveAt(i); oldChild.Parent(null); return; } } }
public override void DefaultIn(Node node) { if (isFirst) isFirst = false; else { int index = 0; CloneMethod.GetChildTypeIndex getChildTypeIndex = new CloneMethod.GetChildTypeIndex() { Parent = node.Parent(), Child = node }; node.Parent().Apply(getChildTypeIndex); index = getChildTypeIndex.Index; CloneMethod.GetChildTypeByIndex getChildTypeByIndex = new CloneMethod.GetChildTypeByIndex() { Child = node, Index = index, Parent = currentClone }; currentClone.Apply(getChildTypeByIndex); currentClone = getChildTypeByIndex.Child; } if (node is ANamedType && data.GenericLinks.ContainsKey((ANamedType) node)) { TIdentifier name = data.GenericLinks[(ANamedType) node]; AStructDecl str = (AStructDecl) name.Parent(); PType type = types[str.GetGenericVars().IndexOf(name)]; replacer = Util.MakeClone(type, data); } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_token_ == oldChild) { SetToken((TSwitch)newChild); return; } if (_test_ == oldChild) { SetTest((PExp)newChild); return; } for (int i = 0; i < _cases_.Count; i++) { Node n = (Node)_cases_[i]; if (n == oldChild) { if (newChild != null) { _cases_[i] = newChild; oldChild.Parent(null); return; } _cases_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_visibility_modifier_ == oldChild) { SetVisibilityModifier((PVisibilityModifier)newChild); return; } if (_trigger_ == oldChild) { SetTrigger((TTrigger)newChild); return; } if (_static_ == oldChild) { SetStatic((TStatic)newChild); return; } if (_native_ == oldChild) { SetNative((TNative)newChild); return; } if (_inline_ == oldChild) { SetInline((TInline)newChild); return; } if (_delegate_ == oldChild) { SetDelegate((TDelegate)newChild); return; } if (_return_type_ == oldChild) { SetReturnType((PType)newChild); return; } if (_name_ == oldChild) { SetName((TIdentifier)newChild); return; } for (int i = 0; i < _formals_.Count; i++) { Node n = (Node)_formals_[i]; if (n == oldChild) { if (newChild != null) { _formals_[i] = newChild; oldChild.Parent(null); return; } _formals_.RemoveAt(i); oldChild.Parent(null); return; } } if (_block_ == oldChild) { SetBlock((PBlock)newChild); return; } }
internal override void ReplaceChild(Node oldChild, Node newChild) { for (int i = 0; i < _namespace_.Count; i++) { Node n = (Node)_namespace_[i]; if (n == oldChild) { if (newChild != null) { _namespace_[i] = newChild; oldChild.Parent(null); return; } _namespace_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_const_ == oldChild) { SetConst((TConst)newChild); return; } if (_type_ == oldChild) { SetType((PType)newChild); return; } for (int i = 0; i < _local_decl_right_.Count; i++) { Node n = (Node)_local_decl_right_[i]; if (n == oldChild) { if (newChild != null) { _local_decl_right_[i] = newChild; oldChild.Parent(null); return; } _local_decl_right_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_token_ == oldChild) { SetToken((TAsyncInvoke)newChild); return; } if (_name_ == oldChild) { SetName((PLvalue)newChild); return; } for (int i = 0; i < _args_.Count; i++) { Node n = (Node)_args_[i]; if (n == oldChild) { if (newChild != null) { _args_[i] = newChild; oldChild.Parent(null); return; } _args_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { for (int i = 0; i < _statements_.Count; i++) { Node n = (Node)_statements_[i]; if (n == oldChild) { if (newChild != null) { _statements_[i] = newChild; oldChild.Parent(null); return; } _statements_.RemoveAt(i); oldChild.Parent(null); return; } } if (_token_ == oldChild) { SetToken((TRBrace)newChild); return; } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_token_ == oldChild) { SetToken((TIdentifier)newChild); return; } if (_receiver_ == oldChild) { SetReceiver((PExp)newChild); return; } for (int i = 0; i < _args_.Count; i++) { Node n = (Node)_args_[i]; if (n == oldChild) { if (newChild != null) { _args_[i] = newChild; oldChild.Parent(null); return; } _args_.RemoveAt(i); oldChild.Parent(null); return; } } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_visibility_modifier_ == oldChild) { SetVisibilityModifier((PVisibilityModifier)newChild); return; } if (_static_ == oldChild) { SetStatic((TStatic)newChild); return; } if (_return_type_ == oldChild) { SetReturnType((PType)newChild); return; } if (_token_ == oldChild) { SetToken((TOperator)newChild); return; } if (_operator_ == oldChild) { SetOperator((PBinop)newChild); return; } for (int i = 0; i < _formals_.Count; i++) { Node n = (Node)_formals_[i]; if (n == oldChild) { if (newChild != null) { _formals_[i] = newChild; oldChild.Parent(null); return; } _formals_.RemoveAt(i); oldChild.Parent(null); return; } } if (_block_ == oldChild) { SetBlock((PBlock)newChild); return; } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_visibility_modifier_ == oldChild) { SetVisibilityModifier((PVisibilityModifier)newChild); return; } if (_static_ == oldChild) { SetStatic((TStatic)newChild); return; } if (_token_ == oldChild) { SetToken((TEnum)newChild); return; } if (_name_ == oldChild) { SetName((TIdentifier)newChild); return; } for (int i = 0; i < _values_.Count; i++) { Node n = (Node)_values_[i]; if (n == oldChild) { if (newChild != null) { _values_[i] = newChild; oldChild.Parent(null); return; } _values_.RemoveAt(i); oldChild.Parent(null); return; } } if (_end_token_ == oldChild) { SetEndToken((TRBrace)newChild); return; } }
internal override void ReplaceChild(Node oldChild, Node newChild) { for (int i = 0; i < _tokens_.Count; i++) { Node n = (Node)_tokens_[i]; if (n == oldChild) { if (newChild != null) { _tokens_[i] = newChild; oldChild.Parent(null); return; } _tokens_.RemoveAt(i); oldChild.Parent(null); return; } } if (_base_ == oldChild) { SetBase((PExp)newChild); return; } }
internal override void ReplaceChild(Node oldChild, Node newChild) { if (_token_ == oldChild) { SetToken((TInitializer)newChild); return; } for (int i = 0; i < _initializer_param_.Count; i++) { Node n = (Node)_initializer_param_[i]; if (n == oldChild) { if (newChild != null) { _initializer_param_[i] = newChild; oldChild.Parent(null); return; } _initializer_param_.RemoveAt(i); oldChild.Parent(null); return; } } if (_body_ == oldChild) { SetBody((PBlock)newChild); return; } }
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; } }