예제 #1
0
        public async Task CompileInternalAsync(ScriptModule module)
        {
            if (module.LoadState != ScriptModuleLoadState.Compiling)
            {
                return;
            }

            // Compile all of our dependencies
            foreach (var dependency in _modules.GetDependencies(module))
            {
                await CompileInternalAsync(dependency);
            }

            Log.Debug("Compiling {Name}");
            var result = await _compiler.CompileAsync(module.GetAssemblyName(), module.Sources);

            if (!result.Success)
            {
                Log.Error("Compilation Failure, error message here etc");
                module.LoadState = ScriptModuleLoadState.None;
                return;
            }
            ;

            module.IL = result.IL;

            // Compile all of our dependents
            foreach (var dependent in _modules.GetDependents(module))
            {
                await CompileInternalAsync(dependent);
            }

            module.LoadState = ScriptModuleLoadState.Loading;
        }