private void CompileDelayedModules() { var ordered = _delayLoadedScripts.OrderBy(x => x.asClass ? 1 : 0).ToArray(); _delayLoadedScripts.Clear(); foreach (var script in ordered) { var compiler = _engine.GetCompilerService(); var source = _engine.Loader.FromFile(script.path); var module = _engine.AttachedScriptsFactory.CreateModuleFromSource(compiler, source, null); if (script.asClass) { _engine.AttachedScriptsFactory.LoadAndRegister(script.identifier, module); _env.NotifyClassAdded(module, script.identifier); } else { _env.NotifyModuleAdded(module, script.identifier); } } _engine.CompileEnvironmentModules(_env); }
private void CompileDelayedModules() { var ordered = _delayLoadedScripts.OrderBy(x => x.asClass ? 1 : 0).ToArray(); _delayLoadedScripts.Clear(); foreach (var script in ordered) { var compiler = _engine.GetCompilerService(); var source = _engine.Loader.FromFile(script.path); var module = _engine.AttachedScriptsFactory.CreateModuleFromSource(compiler, source, null); if (script.asClass) { _engine.AttachedScriptsFactory.LoadAndRegister(script.identifier, module); _env.NotifyClassAdded(module, script.identifier); } else { var loaded = _engine.LoadModuleImage(module); var instance = (IValue)_engine.NewObject(loaded); _env.SetGlobalProperty(script.identifier, instance); _env.NotifyModuleAdded(module, script.identifier); } } }