From 7165b40657526fc618161d7857a814e265f5df7b Mon Sep 17 00:00:00 2001 From: Chronos Ouroboros Date: Wed, 13 Mar 2019 04:54:06 -0300 Subject: [PATCH] Fixed nested dynamic array indexing causing a compilation error. --- src/scripting/backend/codegen.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 3e9b6be0d..44b63ffeb 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -7425,10 +7425,21 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build) build->Emit(OP_LP, start.RegNum, arrayvar.RegNum, build->GetConstantInt(0)); auto f = Create(NAME_None, TypeUInt32, ismeta? VARF_Meta : 0, SizeAddr); - static_cast(Array)->membervar = f; - static_cast(Array)->AddressRequested = false; + auto arraymemberbase = static_cast(Array); + + auto origmembervar = arraymemberbase->membervar; + auto origaddrreq = arraymemberbase->AddressRequested; + auto origvaluetype = Array->ValueType; + + arraymemberbase->membervar = f; + arraymemberbase->AddressRequested = false; Array->ValueType = TypeUInt32; + bound = Array->Emit(build); + + arraymemberbase->membervar = origmembervar; + arraymemberbase->AddressRequested = origaddrreq; + Array->ValueType = origvaluetype; } else start = arrayvar;