Exemplo n.º 1
0
        public static void CheckAddInvocation(ICSharpCode.NRefactory.Semantics.MemberResolveResult res, string methodName)
        {
            var    member       = res.Member;
            string typeFullName = SkJs.GetEntityJsName(member.DeclaringType);
            bool   exported     = Sk.IsJsExported(member);

            if (!exported || typeDefaultIsExported.Contains(typeFullName))
            {
                InvocationLocation Loc = null;
                var firstNode          = res.GetFirstNode();
                if (firstNode != null)
                {
                    Loc = new InvocationLocation {
                        FileName = firstNode.GetFileName(), Line = firstNode.StartLocation.Line
                    }
                }
                ;

                if (Loc != null)
                {
                    if (member.IsStatic)
                    {
                        methodName = "Static_" + methodName;
                    }
                    AddInvocation(typeFullName, methodName, Loc);
                }
            }
        }
Exemplo n.º 2
0
        static void AddInvocation(string typeFullName, string methodName, InvocationLocation Loc)
        {
            Dictionary <string, List <InvocationLocation> > D;

            if (!dictInvocation.TryGetValue(typeFullName, out D))
            {
                D = new Dictionary <string, List <InvocationLocation> >();
                dictInvocation.Add(typeFullName, D);
            }

            List <InvocationLocation> L;

            if (!D.TryGetValue(methodName, out L))
            {
                L = new List <InvocationLocation>();
                D.Add(methodName, L);
            }

            L.Add(Loc);
        }
Exemplo n.º 3
0
        public static void AddYieldReturn(ICSharpCode.NRefactory.CSharp.YieldReturnStatement node)
        {
            var result = node.Expression.Resolve() as ICSharpCode.NRefactory.Semantics.ConversionResolveResult;

            try
            {
                if (result != null)
                {
                    string k;
                    if (result.Input.Type.Kind == TypeKind.Null)
                    {
                        k = "null";
                    }
                    else
                    {
                        k = SkJs.GetEntityJsName(result.Input.Type);
                    }

                    InvocationLocation loc = new InvocationLocation {
                        FileName = node.GetFileName(), Line = node.StartLocation.Line
                    };
                    if (!YieldType2Location.ContainsKey(k))
                    {
                        YieldType2Location.Add(k, new List <InvocationLocation> {
                            loc
                        });
                    }
                    else
                    {
                        YieldType2Location[k].Add(loc);
                    }
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.Message);
            }
        }