mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Don't forward declare CompiledModule
When using `std::unordered_map` it's types have to be complete.
This commit is contained in:
parent
68a7abb3b3
commit
6bdcab11b9
1 changed files with 19 additions and 19 deletions
|
|
@ -47,11 +47,29 @@ class ModuleLoader
|
|||
public:
|
||||
friend ScriptContext;
|
||||
|
||||
class CompiledModule;
|
||||
class Future;
|
||||
class Result;
|
||||
|
||||
using AllowModuleFunc = std::function<bool(const VfsPath&)>;
|
||||
|
||||
class CompiledModule
|
||||
{
|
||||
public:
|
||||
CompiledModule(const ScriptRequest& rq, const AllowModuleFunc& allowModule, const VfsPath& filePath);
|
||||
|
||||
std::tuple<const std::vector<VfsPath>&,
|
||||
const std::vector<std::reference_wrapper<Result>>&> GetRequesters() const;
|
||||
|
||||
void AddRequester(VfsPath importer);
|
||||
void AddRequester(Result& callback);
|
||||
void RemoveRequester(Result* toErase);
|
||||
|
||||
JS::PersistentRootedObject m_ModuleObject;
|
||||
private:
|
||||
std::vector<VfsPath> m_Importer;
|
||||
std::vector<std::reference_wrapper<Result>> m_Callbacks;
|
||||
};
|
||||
|
||||
using RegistryType = std::unordered_map<VfsPath, CompiledModule>;
|
||||
|
||||
ModuleLoader(AllowModuleFunc allowModule);
|
||||
|
|
@ -86,24 +104,6 @@ private:
|
|||
RegistryType m_Registry;
|
||||
};
|
||||
|
||||
class ModuleLoader::CompiledModule
|
||||
{
|
||||
public:
|
||||
CompiledModule(const ScriptRequest& rq, const AllowModuleFunc& allowModule, const VfsPath& filePath);
|
||||
|
||||
std::tuple<const std::vector<VfsPath>&,
|
||||
const std::vector<std::reference_wrapper<Result>>&> GetRequesters() const;
|
||||
|
||||
void AddRequester(VfsPath importer);
|
||||
void AddRequester(Result& callback);
|
||||
void RemoveRequester(Result* toErase);
|
||||
|
||||
JS::PersistentRootedObject m_ModuleObject;
|
||||
private:
|
||||
std::vector<VfsPath> m_Importer;
|
||||
std::vector<std::reference_wrapper<Result>> m_Callbacks;
|
||||
};
|
||||
|
||||
/**
|
||||
* The future is fulfilled once the evaluation of the module
|
||||
* completes.
|
||||
|
|
|
|||
Loading…
Reference in a new issue