From de8cacc4653ceebe19e33b6555834afd5a53dd55 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Nov 2016 12:41:00 +0100 Subject: [PATCH] - for struct member calls an address request is needed. --- src/scripting/codegeneration/codegen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index 8fa8f4554e..4a8f4b55b6 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -7185,6 +7185,12 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) { ValueType = TypeVoid; } + // If self is a struct, it will be a value type, not a reference, so we need to make an addresss request. + if (Self != nullptr && Self->ValueType->IsKindOf(RUNTIME_CLASS(PStruct)) && !Self->ValueType->IsKindOf(RUNTIME_CLASS(PClass))) + { + bool writable; + Self->RequestAddress(ctx, &writable); + } return this; }