mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Fixes issue in MW script compilation that would silently produce the wrong bytecode
Fixes issue when fetching MyGui values that were stored as RefId but fetched as String Removed some uncessary copies, fixed issues with lowercase and uneeded changes
This commit is contained in:
parent
0f3499f504
commit
42e45723b7
12 changed files with 29 additions and 31 deletions
|
@ -205,7 +205,7 @@ namespace Compiler
|
|||
mMemberOp = false;
|
||||
|
||||
std::string name2 = Misc::StringUtils::lowerCase(name);
|
||||
auto id = ESM::RefId::stringRefId(mExplicit);
|
||||
auto id = ESM::RefId::stringRefId(Misc::StringUtils::lowerCase(mExplicit));
|
||||
|
||||
std::pair<char, bool> type = getContext().getMemberType(name2, id);
|
||||
|
||||
|
@ -303,29 +303,31 @@ namespace Compiler
|
|||
{
|
||||
start();
|
||||
|
||||
char type = mLocals.getType(name);
|
||||
std::string name2 = Misc::StringUtils::lowerCase(name);
|
||||
|
||||
char type = mLocals.getType(name2);
|
||||
|
||||
if (type != ' ')
|
||||
{
|
||||
Generator::fetchLocal(mCode, type, mLocals.getIndex(name));
|
||||
Generator::fetchLocal(mCode, type, mLocals.getIndex(name2));
|
||||
mNextOperand = false;
|
||||
mOperands.push_back(type == 'f' ? 'f' : 'l');
|
||||
return true;
|
||||
}
|
||||
|
||||
type = getContext().getGlobalType(name);
|
||||
type = getContext().getGlobalType(name2);
|
||||
|
||||
if (type != ' ')
|
||||
{
|
||||
Generator::fetchGlobal(mCode, mLiterals, type, name);
|
||||
Generator::fetchGlobal(mCode, mLiterals, type, name2);
|
||||
mNextOperand = false;
|
||||
mOperands.push_back(type == 'f' ? 'f' : 'l');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mExplicit.empty() && getContext().isId(ESM::RefId::stringRefId(name)))
|
||||
if (mExplicit.empty() && getContext().isId(ESM::RefId::stringRefId(name2)))
|
||||
{
|
||||
mExplicit = name;
|
||||
mExplicit = name2;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -333,7 +335,7 @@ namespace Compiler
|
|||
// Convert the string to a number even if it's impossible and use it as a number literal.
|
||||
// Can't use stof/atof or to_string out of locale concerns.
|
||||
float number;
|
||||
std::stringstream stream(name);
|
||||
std::stringstream stream(name2);
|
||||
stream >> number;
|
||||
stream.str(std::string());
|
||||
stream.clear();
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <sstream>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/esm/refid.hpp>
|
||||
|
||||
#include "tokenloc.hpp"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue