Exemple #1
0
        private TranslatorResult Process(TranslationContext context)
        {
            context.Body.InstanceCount++;

            if (Checks.IsGenericNestingExceeds(context))
            {
                var code = context.Code.New();
                //_code.AddRange(_provider.ThrowRuntimeError("The max nesting of generic instantiations exceeds"));
                code.AddRange(code.Provider.ThrowTypeLoadException("The max nesting of generic instantiations exceeds"));

                return(new TranslatorResult {
                    Output = code
                });
            }

            ControlFlowGraph.Build(context.Body);

            PushState(context);

            GenericResolver.Resolve(context.Method, context.Body);

            Analyzer.Analyze(context.Body, context.Provider);

            var core = new TranslatorCore(_debugInfo);

            core.Translate(context);

            var result = Emitter.Emit(context, _debugInfo.DebugFile);

            Branch.Resolve(result.Branches, context.Provider);

            context.Provider.Finish();

#if DEBUG
            context.Body.VisualizeGraph(context.Body.ControlFlowGraph.Entry, true);
            DumpILMap("I: N V", "ilmap_i.txt");
#endif

            PopState(context);

            return(result);
        }