mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- allow retrieving the length of a string constant.
This commit is contained in:
parent
6438416adb
commit
09f1859c83
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue