Avoid unnecessary allocations in the FunctionCallExpression class

This commit is contained in:
Gunnar Beutner 2017-11-29 14:11:09 +01:00
parent f3c825cb86
commit db6a1fcdb7
1 changed files with 2 additions and 0 deletions

View File

@ -428,6 +428,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
if (vfunc.IsObjectType<Type>()) {
std::vector<Value> arguments;
arguments.reserve(m_Args.size());
for (Expression *arg : m_Args) {
ExpressionResult argres = arg->Evaluate(frame);
CHECK_RESULT(argres);
@ -447,6 +448,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
BOOST_THROW_EXCEPTION(ScriptError("Function is not marked as safe for sandbox mode.", m_DebugInfo));
std::vector<Value> arguments;
arguments.reserve(m_Args.size());
for (Expression *arg : m_Args) {
ExpressionResult argres = arg->Evaluate(frame);
CHECK_RESULT(argres);