implement move constructor

pull/578/head
Evil Eye 5 years ago
parent 8958e29187
commit a16727d5e3

@ -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);

@ -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)

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

Loading…
Cancel
Save