diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index a8aa1a897..a9c7e4fcc 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -9378,6 +9378,13 @@ FxExpression *FxStrLen::Resolve(FCompileContext &ctx) { SAFE_RESOLVE(Self, ctx); assert(Self->ValueType == TypeString); + if (Self->isConstant()) + { + auto constself = static_cast(Self); + auto constlen = new FxConstant((int)constself->GetValue().GetString().Len(), Self->ScriptPosition); + delete this; + return constlen->Resolve(ctx); + } ValueType = TypeUInt32; return this; }