Browse Source

Implemented mAllowReadOnlyReference for expression-bodied methods

Brian Fiete 3 years ago
parent
commit
688c80e2fc
1 changed files with 5 additions and 1 deletions
  1. 5 1
      IDEHelper/Compiler/BfModule.cpp

+ 5 - 1
IDEHelper/Compiler/BfModule.cpp

@@ -21239,8 +21239,12 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
 						expectingType = NULL;
 				}
 
+				BfExprEvaluator exprEvaluator(this);
+				if (mCurMethodInstance->mMethodDef->mIsReadOnly)
+					exprEvaluator.mAllowReadOnlyReference = true;
+
 				UpdateSrcPos(expressionBody);
-				auto retVal = CreateValueFromExpression(expressionBody, expectingType, exprEvalFlags);
+				auto retVal = CreateValueFromExpression(exprEvaluator, expressionBody, expectingType, exprEvalFlags);
 				if ((retVal) && (!retVal.mType->IsVar()) && (expectingType != NULL))
 				{
 					mCurMethodState->mHadReturn = true;