1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Comptime method fixes

This commit is contained in:
Brian Fiete 2021-11-28 09:42:22 -08:00
parent 0927656400
commit ed06ff4dce
5 changed files with 37 additions and 7 deletions

View file

@ -4608,7 +4608,8 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
{
mModule->CheckStaticAccess(curCheckType);
auto retVal = mModule->ReferenceStaticField(fieldInstance);
bool isStaticCtor = (mModule->mCurMethodInstance != NULL) && (mModule->mCurMethodInstance->mMethodDef->mMethodType == BfMethodType_Ctor) &&
bool isStaticCtor = (mModule->mCurMethodInstance != NULL) &&
(mModule->mCurMethodInstance->mMethodDef->IsCtorOrInit()) &&
(mModule->mCurMethodInstance->mMethodDef->mIsStatic);
if ((field->mIsReadOnly) && (!isStaticCtor))
{
@ -4652,7 +4653,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
bool isTemporary = target.IsTempAddr();
bool wantsLoadValue = false;
bool wantsReadOnly = false;
if ((field->mIsReadOnly) && (mModule->mCurMethodInstance != NULL) && ((mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Ctor) || (!target.IsThis())))
if ((field->mIsReadOnly) && (mModule->mCurMethodInstance != NULL) && ((!mModule->mCurMethodInstance->mMethodDef->IsCtorOrInit()) || (!target.IsThis())))
wantsReadOnly = true;
bool isComposite = target.mType->IsComposite();