예제 #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);
        }
예제 #2
0
        public static string Format <T>(this Dim[] shape, IExpr <T> target)
        {
            var generator = new InlineCodeGenerator(null);

            generator.ObsoleteProcessArray <T, int>(target, shape);
            return(generator.Result);
        }
예제 #3
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);
        }
예제 #4
0
 public override string ToString() => InlineCodeGenerator.GetCode(this);