diff --git a/src/tdme/tools/cli/miniscripttranspiler-main.cpp b/src/tdme/tools/cli/miniscripttranspiler-main.cpp index 37e806450..a3ad4927f 100644 --- a/src/tdme/tools/cli/miniscripttranspiler-main.cpp +++ b/src/tdme/tools/cli/miniscripttranspiler-main.cpp @@ -395,7 +395,7 @@ static void createArrayAccessMethods(MiniScript* miniScript, string& generatedDe static void generateMiniScriptEvaluateMemberAccessArrays(MiniScript* miniScript, vector& declarations, vector& definitions) { auto scriptMethods = miniScript->getMethods(); - auto allMethods = MiniScriptTranspiler::getAllMethodNames(miniScript); + auto allMethods = MiniScriptTranspiler::getAllMethodNamesSorted(miniScript); auto methodsByClasses = MiniScriptTranspiler::getAllClassesMethodNames(miniScript); declarations.push_back("// evaluate member access constants"); declarations.push_back("static constexpr int EVALUATEMEMBERACCESSARRAYIDX_NONE { -1 };"); diff --git a/src/tdme/utilities/MiniScriptTranspiler.cpp b/src/tdme/utilities/MiniScriptTranspiler.cpp index d1a902bba..d2ef2d120 100644 --- a/src/tdme/utilities/MiniScriptTranspiler.cpp +++ b/src/tdme/utilities/MiniScriptTranspiler.cpp @@ -38,7 +38,7 @@ using tdme::math::Vector4; using tdme::utilities::Console; using tdme::utilities::StringTools; -const vector MiniScriptTranspiler::getAllMethodNames(MiniScript* miniScript) { +const unordered_set MiniScriptTranspiler::getAllMethodNames(MiniScript* miniScript) { unordered_set allMethods; for (auto scriptMethod: miniScript->getMethods()) { string className; @@ -58,6 +58,12 @@ const vector MiniScriptTranspiler::getAllMethodNames(MiniScript* miniScr allMethods.insert(method); } // + return allMethods; +} + +const vector MiniScriptTranspiler::getAllMethodNamesSorted(MiniScript* miniScript) { + auto allMethods = getAllMethodNames(miniScript); + // vector result; for (auto method: allMethods) result.push_back(method); sort(result.begin(), result.end()); diff --git a/src/tdme/utilities/MiniScriptTranspiler.h b/src/tdme/utilities/MiniScriptTranspiler.h index a27e0193d..04ded78a0 100644 --- a/src/tdme/utilities/MiniScriptTranspiler.h +++ b/src/tdme/utilities/MiniScriptTranspiler.h @@ -25,10 +25,17 @@ class tdme::utilities::MiniScriptTranspiler { * @param miniScript MiniScript instance * @return all method names */ - static const vector getAllMethodNames(MiniScript* miniScript); + static const unordered_set getAllMethodNames(MiniScript* miniScript); /** - * Get all method names + * Get all method names sorted + * @param miniScript MiniScript instance + * @return all method names sorted + */ + static const vector getAllMethodNamesSorted(MiniScript* miniScript); + + /** + * Get all method names by class name * @param miniScript MiniScript instance * @return all method names */