MCPcopy Create free account
hub / github.com/beefytech/Beef / DoMethodDeclaration

Method DoMethodDeclaration

IDEHelper/Compiler/BfModule.cpp:24631–26042  ·  view source on GitHub ↗

methodDeclaration is NULL for default constructors

Source from the content-addressed store, hash-verified

24629
24630// methodDeclaration is NULL for default constructors
24631void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool isTemporaryFunc, bool addToWorkList)
24632{
24633 BF_ASSERT((mCompiler->mCeMachine == NULL) || (!mCompiler->mCeMachine->mDbgPaused));
24634
24635 BP_ZONE("BfModule::DoMethodDeclaration");
24636
24637 auto typeInstance = mCurTypeInstance;
24638 auto typeDef = typeInstance->mTypeDef;
24639 auto methodDef = mCurMethodInstance->mMethodDef;
24640
24641 // We could trigger a DoMethodDeclaration from a const resolver or other location, so we reset it here
24642 // to effectively make mIgnoreWrites method-scoped
24643 SetAndRestoreValue<bool> prevIgnoreWrites(mBfIRBuilder->mIgnoreWrites, mWantsIRIgnoreWrites || mCurMethodInstance->mIsUnspecialized || mCurTypeInstance->mResolvingVarField);
24644 SetAndRestoreValue<bool> prevIsCapturingMethodMatchInfo;
24645 SetAndRestoreValue<bool> prevAllowLockYield(mContext->mAllowLockYield, false);
24646 BfTypeState typeState(mCurTypeInstance);
24647 typeState.mPrevState = mContext->mCurTypeState;
24648 typeState.mCurMethodDef = methodDef;
24649 SetAndRestoreValue<BfTypeState*> prevTypeState(mContext->mCurTypeState, &typeState);
24650
24651 BfModule* resolveModule = mContext->mUnreifiedModule;
24652
24653 if (mCompiler->IsAutocomplete())
24654 prevIsCapturingMethodMatchInfo.Init(mCompiler->mResolvePassData->mAutoComplete->mIsCapturingMethodMatchInfo, false);
24655
24656 if (mCurMethodInstance->mMethodInstanceGroup->mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference)
24657 mCurMethodInstance->mMethodInstanceGroup->mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingReference;
24658
24659 BfMethodState methodState;
24660 SetAndRestoreValue<BfMethodState*> prevMethodState(mCurMethodState, &methodState);
24661 methodState.mTempKind = BfMethodState::TempKind_Static;
24662
24663 defer({ mCurMethodInstance->mHasBeenDeclared = true; });
24664
24665 // If we are doing this then we may end up creating methods when var types are unknown still, failing on splat/zero-sized info
24666 BF_ASSERT((!mCurTypeInstance->mResolvingVarField) || (mBfIRBuilder->mIgnoreWrites));
24667
24668 bool ignoreWrites = mBfIRBuilder->mIgnoreWrites;
24669
24670// if ((!isTemporaryFunc) && (mCurTypeInstance->mDefineState < BfTypeDefineState_Defined))
24671// {
24672// BF_ASSERT(mContext->mResolvingVarField);
24673// isTemporaryFunc = true;
24674// }
24675
24676 if ((mAwaitingInitFinish) && (!mBfIRBuilder->mIgnoreWrites))
24677 FinishInit();
24678
24679 if (methodDef->mName.StartsWith('_'))
24680 {
24681 BF_ASSERT(methodDef->mName != "__ASSERTNAME");
24682 if (methodDef->mName == "__FATALERRORNAME")
24683 BFMODULE_FATAL(this, "__FATALERRORNAME");
24684 if (methodDef->mName == "__STACKOVERFLOW")
24685 StackOverflow();
24686 if (methodDef->mName == "__INTERNALERROR")
24687 InternalError("Bad method name", methodDef->GetRefNode());
24688 }

Callers 3

GetMethodInstanceMethod · 0.80

Calls 15

StackOverflowFunction · 0.85
FailFunction · 0.85
AutoCompleteEntryClass · 0.85
BfTypedValueClass · 0.85
BfIRFunctionClass · 0.85
TypeToStringFunction · 0.85
BfMemberSetEntryClass · 0.85
IsAutocompleteMethod · 0.80
CheckTypeRefMethod · 0.80
IsAutocompleteNodeMethod · 0.80
SetDefinitionLocationMethod · 0.80

Tested by

no test coverage detected