From d25e81570152d3662efb8c65a0b259d3e5271f0e Mon Sep 17 00:00:00 2001 From: EinBurgbauer Date: Sun, 2 May 2021 12:11:16 +0200 Subject: [PATCH] fixed crash when writing static unary operator --- IDEHelper/Compiler/BfModule.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 8a9e3447..8156201f 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -18586,17 +18586,20 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup) { if (methodDef->mIsStatic) { - auto checkParam0 = mCurMethodInstance->GetParamType(0); - if ((checkParam0->IsRef()) && (!checkParam0->IsOut())) - checkParam0 = checkParam0->GetUnderlyingType(); - if (methodDef->mParams.size() != 1) { Fail("Unary operators must declare one parameter", paramErrorRefNode); } - else if ((checkParam0 != mCurTypeInstance) && (!checkParam0->IsSelf())) + else { - Fail("The parameter of a unary operator must be the containing type", paramErrorRefNode); + auto checkParam0 = mCurMethodInstance->GetParamType(0); + if ((checkParam0->IsRef()) && (!checkParam0->IsOut())) + checkParam0 = checkParam0->GetUnderlyingType(); + + if ((checkParam0 != mCurTypeInstance) && (!checkParam0->IsSelf())) + { + Fail("The parameter of a unary operator must be the containing type", paramErrorRefNode); + } } if (((operatorDef->mOperatorDeclaration->mUnaryOp == BfUnaryOp_Increment) ||