Esempio n. 1
0
        private IMethodCall Resolve(IMethod method, AbcInstance instance)
        {
            var inlineCall = InlineCodeGenerator.Build(Abc, instance, method);

            if (inlineCall != null)
            {
                return(inlineCall);
            }

            if (method.CodeType == MethodCodeType.Native)
            {
                return(ThrowOrDefineNotImplCall(method, instance));
            }

            if (method.IsInternalCall)
            {
                return(ResolveInternalCall(method, instance));
            }

            if (method.CodeType == MethodCodeType.Runtime)
            {
                return(ResolveRuntimeCode(method, instance));
            }

            return(null);
        }
Esempio n. 2
0
        //Entry point to resolve spec runtime calls
        public IMethodCall Resolve(IMethod method)
        {
            var type = method.DeclaringType;

            IMethodCall call;

            var internalType = type.Data as InternalType;

            if (internalType != null)
            {
                Debug.Assert(method.IsInternalCall);

                call = Resolve(method, null);
                if (call == null)
                {
                    throw new InvalidOperationException();
                }

                return(SetData(method, call));
            }

            var instance   = type.AbcInstance();
            var inlineCall = InlineCodeGenerator.Build(Abc, instance, method);

            if (inlineCall != null)
            {
                return(SetData(method, inlineCall));
            }

            if (instance != null)
            {
                call = Resolve(method, instance);
                if (call != null)
                {
                    return(SetData(method, call));
                }
            }

            if (!method.IsImplemented())
            {
                throw new InvalidOperationException();
            }

            return(null);
        }