public static List <KeyValuePair <IMethod, INode> > calledIMethods_getMappings(this O2MappedAstData o2MappedAstData, IMethod iMethod)
        {
            //"in Called IMETHODS".debug();\
            var calledIMethodsMapping = new List <KeyValuePair <IMethod, INode> >();

            if (iMethod != null)
            {
                //  "-------------------".info();
                var methodDeclaration = o2MappedAstData.methodDeclaration(iMethod);
                if (methodDeclaration == null)
                {
                    return(calledIMethodsMapping);
                }

                // handle invocations via MemberReferenceExpression
                var memberReferenceExpressions = methodDeclaration.iNodes <INode, MemberReferenceExpression>();
                foreach (var memberReferenceExpression in memberReferenceExpressions)
                {
                    var iMethodFromRef = o2MappedAstData.iMethod(memberReferenceExpression);
                    if (iMethodFromRef.notNull())
                    {
                        calledIMethodsMapping.Add(iMethodFromRef.iMethodMapping(memberReferenceExpression));
                    }
                    else
                    {
                        var iMethodOrProperty = o2MappedAstData.fromMemberReferenceExpressionGetIMethodOrProperty(memberReferenceExpression);
                        if (iMethodOrProperty is IMethod)
                        {
                            calledIMethodsMapping.Add((iMethodOrProperty as IMethod).iMethodMapping(memberReferenceExpression));
                        }
                        //else
                        //	"NOT Resolved for: {0}".error(memberReferenceExpression.MemberName);
                    }
                }
//                    calledIMethods.add();

                // handle invocations via InvocationExpression
                var invocationExpressions = methodDeclaration.iNodes <INode, InvocationExpression>();
                foreach (var invocationExpression in invocationExpressions)
                {
                    calledIMethodsMapping.add(o2MappedAstData.iMethod(invocationExpression).iMethodMapping(invocationExpression));
                }

                // handle contructors
                var objectCreateExpressions = methodDeclaration.iNodes <INode, ObjectCreateExpression>();
                //"objectCreateExpressions: {0}".format(objectCreateExpressions.Count).info();
                foreach (var objectCreateExpression in objectCreateExpressions)
                {
                    calledIMethodsMapping.add(o2MappedAstData.iMethod(objectCreateExpression).iMethodMapping(objectCreateExpression));
                }
            }
            //return calledIMethods;
            return(calledIMethodsMapping);
        }
        public static Dictionary <string, List <KeyValuePair <INode, IMethodOrProperty> > > externalMethodsAndProperties(this O2MappedAstData astData, IMethod iMethod)
        {
            var externalMethods = new Dictionary <string, List <KeyValuePair <INode, IMethodOrProperty> > >();

            // add the current method

            externalMethods.add(iMethod.DotNetName, new KeyValuePair <INode, IMethodOrProperty>(astData.methodDeclaration(iMethod), iMethod));

            var iNodesAdded = new List <INode>();

            foreach (var methodCalled in astData.calledINodesReferences(iMethod))
            {
                if (methodCalled is MemberReferenceExpression)
                {
                    var memberRef = (MemberReferenceExpression)methodCalled;
                    {
                        var methodOrProperty = astData.fromMemberReferenceExpressionGetIMethodOrProperty(memberRef);
                        if (methodOrProperty.notNull())
                        {
                            externalMethods.add(methodOrProperty.DotNetName, new KeyValuePair <INode, IMethodOrProperty>(memberRef, methodOrProperty));
                            iNodesAdded.Add(memberRef);
                        }
                        else
                        {
                            externalMethods.add(astData.getTextForINode(memberRef), new KeyValuePair <INode, IMethodOrProperty>(memberRef, null));
                        }
                    }
                }
            }


            foreach (var mapping in astData.calledIMethods_getMappings(iMethod))
            {
                var iMethodMapping = mapping.Key;
                var iNodeMapping   = mapping.Value;
                if (iNodesAdded.Contains(iNodeMapping).isFalse())
                {
                    if (iNodeMapping is ObjectCreateExpression ||
                        ((iNodeMapping is InvocationExpression &&
                          (iNodeMapping as InvocationExpression).TargetObject.notNull() &&
                          iNodesAdded.Contains((iNodeMapping as InvocationExpression).TargetObject).isFalse())))
                    {
                        var nodeText = (iMethodMapping.notNull())
                                                                                                ? iMethodMapping.DotNetName
                                                                                                : astData.getTextForINode(iNodeMapping);
                        externalMethods.add(nodeText, new KeyValuePair <INode, IMethodOrProperty>(iNodeMapping, iMethodMapping));
                    }
                }
            }

            return(externalMethods);
        }