Пример #1
0
        /// <summary>
        /// Gets the instance type that calls the given method.
        /// Create if needed.
        /// </summary>
        public DelegateInstanceType GetOrCreateInstance(ISourceLocation sequencePoint, DexTargetPackage targetPackage, XMethodDefinition calledMethod)
        {
            DelegateInstanceType result;

            if (instances.TryGetValue(calledMethod, out result))
            {
                return(result);
            }

            // Ensure prototype exists
            if (invokePrototype == null)
            {
                invokePrototype = PrototypeBuilder.BuildPrototype(compiler, targetPackage, interfaceClass, invokeMethod);
            }



            // Not found, build it.
            var builder = new DelegateInstanceTypeBuilder(sequencePoint, compiler, targetPackage, InterfaceClass,
                                                          invokeMethod, invokePrototype, calledMethod);

            result = builder.Create();
            instances.Add(calledMethod, result);
            return(result);
        }
Пример #2
0
        /// <summary>
        /// Gets the instance type that calls the given method.
        /// Create if needed.
        /// </summary>
        public DelegateInstanceType GetOrCreateInstance(ISourceLocation sequencePoint, DexTargetPackage targetPackage, XMethodDefinition calledMethod)
        {
            DelegateInstanceType result;
            if (instances.TryGetValue(calledMethod, out result))
                return result;

            // Ensure prototype exists
            if (invokePrototype == null)
            {
                invokePrototype = PrototypeBuilder.BuildPrototype(compiler, targetPackage, interfaceClass, invokeMethod);
            }

            

            // Not found, build it.
            var builder = new DelegateInstanceTypeBuilder(sequencePoint, compiler, targetPackage, InterfaceClass, 
                                                          invokeMethod, invokePrototype, calledMethod);
            result = builder.Create();
            instances.Add(calledMethod, result);
            return result;
        }