Replace mwscript program serialization into a vector with simple struct

Mostly to avoid string literal lookup by index with iteration over all preciding
literals and calling strlen. This is very inefficient. In genral this makes code
much more straightforward but also makes it portable since now int and float of
different sizes are properly supported.
This commit is contained in:
elsid 2023-01-10 04:10:18 +01:00
parent 60eede6a1d
commit b88f0d2dbd
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
21 changed files with 93 additions and 162 deletions

View file

@ -23,8 +23,7 @@ namespace Compiler
/// \param end of script is marked by end keyword.
ScriptParser(ErrorHandler& errorHandler, const Context& context, Locals& locals, bool end = false);
void getCode(std::vector<Interpreter::Type_Code>& code) const;
///< store generated code in \a code.
Interpreter::Program getProgram() const;
bool parseName(const std::string& name, const TokenLoc& loc, Scanner& scanner) override;
///< Handle a name token.