mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
Use verbose error message with DECORATE array indices
This commit is contained in:
parent
b4e712ab01
commit
054f5c963e
1 changed files with 10 additions and 4 deletions
|
@ -3548,6 +3548,16 @@ FxExpression *FxArrayElement::Resolve(FCompileContext &ctx)
|
||||||
delete this;
|
delete this;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (index->isConstant())
|
||||||
|
{
|
||||||
|
unsigned indexval = static_cast<FxConstant *>(index)->GetValue().GetInt();
|
||||||
|
if (indexval >= arraytype->ElementCount)
|
||||||
|
{
|
||||||
|
ScriptPosition.Message(MSG_ERROR, "Array index out of bounds");
|
||||||
|
delete this;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ValueType = arraytype->ElementType;
|
ValueType = arraytype->ElementType;
|
||||||
if (ValueType->GetRegType() != REGT_INT && ValueType->GetRegType() != REGT_FLOAT)
|
if (ValueType->GetRegType() != REGT_INT && ValueType->GetRegType() != REGT_FLOAT)
|
||||||
|
@ -3583,10 +3593,6 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build)
|
||||||
if (index->isConstant())
|
if (index->isConstant())
|
||||||
{
|
{
|
||||||
unsigned indexval = static_cast<FxConstant *>(index)->GetValue().GetInt();
|
unsigned indexval = static_cast<FxConstant *>(index)->GetValue().GetInt();
|
||||||
if (indexval >= arraytype->ElementCount)
|
|
||||||
{
|
|
||||||
I_Error("Array index out of bounds");
|
|
||||||
}
|
|
||||||
indexval *= arraytype->ElementSize;
|
indexval *= arraytype->ElementSize;
|
||||||
|
|
||||||
if (AddressRequested)
|
if (AddressRequested)
|
||||||
|
|
Loading…
Reference in a new issue