Boo.Lang.Compiler.BooCompiler.Run C# (CSharp) Метод

Run() публичный Метод

public Run ( ) : CompilerContext
Результат CompilerContext
        public CompilerContext Run()
        {
            return Run(new CompileUnit());
        }

Same methods

BooCompiler::Run ( Boo.Lang.Compiler.Ast.CompileUnit compileUnit ) : CompilerContext

Usage Example

        public void Run(string text)
        {
            BooCompiler compiler = new BooCompiler();
            compiler.Parameters.Ducky = true;
            compiler.Parameters.Pipeline = new CompileToMemory();
            compiler.Parameters.Input.Add(new StringInput("Script", text));

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                compiler.Parameters.References.Add(assembly);
            }

            CompilerContext context = compiler.Run();

            if (context.GeneratedAssembly == null)
            {
                if (context.Errors.Count > 0)
                {
                    errors = context.Errors.ToString(true);
                }
                return;
            }

            try
            {
                Type[] types = context.GeneratedAssembly.GetTypes();
                Type scriptModule = types[types.Length - 1];
                MethodInfo mainEntry = scriptModule.Assembly.EntryPoint;
                mainEntry.Invoke(null, new object[mainEntry.GetParameters().Length]);
            }
            catch (Exception ex)
            {
                errors = ex.Message;
            }
        }
All Usage Examples Of Boo.Lang.Compiler.BooCompiler::Run