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

Fixed inline set on extern methods

This commit is contained in:
Brian Fiete 2021-01-03 05:34:14 -08:00
parent 496eae24ad
commit 04126a7e40
2 changed files with 7 additions and 2 deletions

View file

@ -822,7 +822,12 @@ void BfDefBuilder::ParseAttributes(BfAttributeDirective* attributes, BfMethodDef
else if (typeRefName == "CVarArgs") else if (typeRefName == "CVarArgs")
methodDef->mCallingConvention = BfCallingConvention_CVarArgs; methodDef->mCallingConvention = BfCallingConvention_CVarArgs;
else if (typeRefName == "Inline") else if (typeRefName == "Inline")
methodDef->mAlwaysInline = true; {
if (methodDef->mIsExtern)
Fail("Extern methods cannot be inline", attributes->mAttributeTypeRef);
else
methodDef->mAlwaysInline = true;
}
else if (typeRefName == "AllowAppend") else if (typeRefName == "AllowAppend")
{ {
methodDef->mHasAppend = true; methodDef->mHasAppend = true;

View file

@ -4124,7 +4124,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
mModule->AddDependency(curCheckType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_ConstEvalConstField); mModule->AddDependency(curCheckType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_ConstEvalConstField);
if ((mModule->mContext->mCurTypeState != NULL) && (mModule->mContext->mCurTypeState->mCurFieldDef != NULL)) if ((mModule->mContext->mCurTypeState != NULL) && (mModule->mContext->mCurTypeState->mCurFieldDef != NULL))
{ {
// If we're initializing another const field then // If we're initializing another const field then also set it as having const eval
auto resolvingFieldInstance = &mModule->mContext->mCurTypeState->mTypeInstance->mFieldInstances[mModule->mContext->mCurTypeState->mCurFieldDef->mIdx]; auto resolvingFieldInstance = &mModule->mContext->mCurTypeState->mTypeInstance->mFieldInstances[mModule->mContext->mCurTypeState->mCurFieldDef->mIdx];
if (resolvingFieldInstance->GetFieldDef()->mIsConst) if (resolvingFieldInstance->GetFieldDef()->mIsConst)
resolvingFieldInstance->mHadConstEval = true; resolvingFieldInstance->mHadConstEval = true;