- allow retrieving the length of a string constant.

This commit is contained in:
Christoph Oelckers 2018-01-21 18:49:46 +01:00
parent 6438416adb
commit 09f1859c83

View file

@ -9378,6 +9378,13 @@ FxExpression *FxStrLen::Resolve(FCompileContext &ctx)
{
SAFE_RESOLVE(Self, ctx);
assert(Self->ValueType == TypeString);
if (Self->isConstant())
{
auto constself = static_cast<FxConstant *>(Self);
auto constlen = new FxConstant((int)constself->GetValue().GetString().Len(), Self->ScriptPosition);
delete this;
return constlen->Resolve(ctx);
}
ValueType = TypeUInt32;
return this;
}