diff --git a/components/compiler/extensions.cpp b/components/compiler/extensions.cpp index d5d87129d6..2ad5828be4 100644 --- a/components/compiler/extensions.cpp +++ b/components/compiler/extensions.cpp @@ -51,11 +51,11 @@ namespace Compiler } void Extensions::registerFunction( - const std::string& keyword, ScriptReturn returnType, ScriptArgs argumentType, int code, int codeExplicit) + std::string_view keyword, ScriptReturn returnType, std::string_view argumentType, int code, int codeExplicit) { Function function; - if (argumentType.find('/') == std::string::npos) + if (argumentType.find('/') == std::string_view::npos) { function.mSegment = 5; assert(code >= 33554432 && code <= 67108863); @@ -73,7 +73,7 @@ namespace Compiler mKeywords.emplace(keyword, keywordIndex); function.mReturn = returnType; - function.mArguments = std::move(argumentType); + function.mArguments = argumentType; function.mCode = code; function.mCodeExplicit = codeExplicit; @@ -81,11 +81,11 @@ namespace Compiler } void Extensions::registerInstruction( - const std::string& keyword, ScriptArgs argumentType, int code, int codeExplicit) + std::string_view keyword, std::string_view argumentType, int code, int codeExplicit) { Instruction instruction; - if (argumentType.find('/') == std::string::npos) + if (argumentType.find('/') == std::string_view::npos) { instruction.mSegment = 5; assert(code >= 33554432 && code <= 67108863); @@ -102,7 +102,7 @@ namespace Compiler mKeywords.emplace(keyword, keywordIndex); - instruction.mArguments = std::move(argumentType); + instruction.mArguments = argumentType; instruction.mCode = code; instruction.mCodeExplicit = codeExplicit; diff --git a/components/compiler/extensions.hpp b/components/compiler/extensions.hpp index 9e888777e1..b07c666861 100644 --- a/components/compiler/extensions.hpp +++ b/components/compiler/extensions.hpp @@ -80,15 +80,16 @@ namespace Compiler /// \param explicitReference In: has explicit reference; Out: set to false, if /// explicit reference is not available for this instruction. - void registerFunction(const std::string& keyword, ScriptReturn returnType, ScriptArgs argumentType, int code, - int codeExplicit = -1); + void registerFunction(std::string_view keyword, ScriptReturn returnType, std::string_view argumentType, + int code, int codeExplicit = -1); ///< Register a custom function /// - keyword must be all lower case. /// - keyword must be unique /// - if explicit references are not supported, segment5codeExplicit must be set to -1 /// \note Currently only segment 3 and segment 5 opcodes are supported. - void registerInstruction(const std::string& keyword, ScriptArgs argumentType, int code, int codeExplicit = -1); + void registerInstruction( + std::string_view keyword, std::string_view argumentType, int code, int codeExplicit = -1); ///< Register a custom instruction /// - keyword must be all lower case. /// - keyword must be unique