1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:59:56 +00:00

implement move constructor

This commit is contained in:
Evil Eye 2020-04-02 20:27:52 +02:00
parent 8958e29187
commit a16727d5e3
3 changed files with 8 additions and 1 deletions

View file

@ -171,7 +171,7 @@ namespace MWScript
{
Compiler::Locals locals;
Compiler::ContextRestore restore = mErrorHandler.setContext(name2 + "[local variables]", true);
const Compiler::ContextRestore&& restore = mErrorHandler.setContext(name2 + "[local variables]", true);
std::istringstream stream (script->mScriptText);
Compiler::QuickFileParser parser (mErrorHandler, mCompilerContext, locals);

View file

@ -72,6 +72,11 @@ namespace Compiler
ContextRestore::ContextRestore(StreamErrorHandler* handler, const std::string& context) : mHandler(handler), mContext(context) {}
ContextRestore::ContextRestore(ContextRestore&& other) : mHandler(other.mHandler), mContext(other.mContext)
{
other.mHandler = nullptr;
}
ContextRestore::~ContextRestore()
{
if(mHandler)

View file

@ -42,6 +42,8 @@ namespace Compiler
public:
ContextRestore (StreamErrorHandler* handler, const std::string& context);
ContextRestore (ContextRestore&& other);
~ContextRestore();
};
}