示例#1
0
        private JSCachedMethod GetCachedMethod(JSMethod method)
        {
            if (!IsCacheable(method))
            {
                return(null);
            }

            var type = method.Reference.DeclaringType.Resolve();

            if (type == null)
            {
                return(null);
            }

            var identifier = new QualifiedMemberIdentifier(
                new TypeIdentifier(type),
                new MemberIdentifier(TypeInfo, method.Reference)
                );

            CachedMethodRecord record;

            if (!CachedMethods.TryGetValue(identifier, out record))
            {
                CachedMethods.Add(identifier, record = new CachedMethodRecord(method, NextID++));
            }

            return(new JSCachedMethod(
                       method.Reference, method.Method,
                       method.MethodTypes, method.GenericArguments,
                       record.Index
                       ));
        }
示例#2
0
        private JSCachedMethod GetCachedMethod (JSMethod method) {
            if (!IsCacheable(method))
                return null;

            var type = method.Reference.DeclaringType.Resolve();
            if (type == null)
                return null;

            var identifier = new QualifiedMemberIdentifier(
                new TypeIdentifier(type),
                new MemberIdentifier(TypeInfo, method.Reference)
            );

            CachedMethodRecord record;
            if (!CachedMethods.TryGetValue(identifier, out record))
                CachedMethods.Add(identifier, record = new CachedMethodRecord(method, NextID++));

            return new JSCachedMethod(
                method.Reference, method.Method,
                method.MethodTypes, method.GenericArguments,
                record.Index
            );
        }