Create new string in Lexer when not passed by reference
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2019-06-06 20:07:55 +02:00
parent 976b4ef2ec
commit 7f73bf07d2
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 3 additions and 3 deletions

View File

@ -12,8 +12,8 @@ Lexer::Lexer(string* scriptString, class Script* script) {
this -> _position = 0;
}
Lexer::Lexer(string scriptString, class Script *script) {
this -> _scriptString = &scriptString;
Lexer::Lexer(const string& scriptString, class Script *script) {
this -> _scriptString = new string(scriptString);
this->_scriptSize = scriptString.size();
this -> ScriptData = script;
this -> _position = 0;

View File

@ -25,7 +25,7 @@ public:
vector<IToken*> Lex();
explicit Lexer(string* scriptString, class Script* script);
explicit Lexer(string scriptString, class Script* script);
explicit Lexer(const string& scriptString, class Script* script);
};