Always pass the script string around by reference

This commit is contained in:
2019-06-13 17:37:23 +02:00
parent 10a2535c96
commit 601c4a3f89
7 changed files with 16 additions and 28 deletions

View File

@@ -7,9 +7,9 @@
#include "Parser/Parser.hpp"
#include "Binder/Binder.hpp"
Script* Script::Create(string script) {
Script* Script::Create(const string& script) {
auto s = new Script();
s -> Parse(std::move(script));
s -> Parse(script);
return s;
}
@@ -32,8 +32,8 @@ Script::~Script() {
delete this->_scriptVariables;
}
void Script::Parse(string script) {
auto lexer = Lexer(&script, this);
void Script::Parse(const string& script) {
auto lexer = Lexer(script, this);
auto lexResult = lexer.Lex();
auto parser = Parser(lexResult, this);
auto parseResult = parser.Parse();