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

Method EvaluateInContext

IDEHelper/Compiler/CeDebugger.cpp:187–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187BfTypedValue CeEvaluationContext::EvaluateInContext(BfTypedValue contextTypedValue, CeDbgState* dbgState)
188{
189 if (mResultOverride)
190 return mResultOverride;
191
192 if (mExprNode == NULL)
193 return BfTypedValue();
194 mPassInstance->ClearErrors();
195
196 auto ceFrame = mDebugger->GetFrame(mCallStackIdx);
197
198 auto module = mDebugger->mCeMachine->mCeModule;
199
200 SetAndRestoreValue<BfTypeInstance*> prevTypeInstance(module->mCurTypeInstance, ceFrame->mFunction->mMethodInstance->GetOwner());
201 SetAndRestoreValue<BfMethodInstance*> prevMethodInstance(module->mCurMethodInstance, ceFrame->mFunction->mMethodInstance);
202 SetAndRestoreValue<BfPassInstance*> prevPassInstance(mDebugger->mCompiler->mPassInstance, mPassInstance);
203 SetAndRestoreValue<bool> prevIgnoreWrites(module->mBfIRBuilder->mIgnoreWrites, true);
204
205 BfMethodState methodState;
206 SetAndRestoreValue<BfMethodState*> prevMethodState(module->mCurMethodState, &methodState);
207 methodState.mTempKind = module->mCurMethodInstance->mMethodDef->mIsStatic ? BfMethodState::TempKind_Static : BfMethodState::TempKind_NonStatic;
208
209 CeDbgState localDbgState;
210 if (dbgState == NULL)
211 dbgState = &localDbgState;
212
213 dbgState->mActiveFrame = ceFrame;
214 dbgState->mCeContext = mDebugger->mCeMachine->mCurContext;
215 if (contextTypedValue)
216 dbgState->mExplicitThis = contextTypedValue;
217 else
218 dbgState->mExplicitThis = mExplicitThis;
219 SetAndRestoreValue<CeDbgState*> prevDbgState(mDebugger->mCurDbgState, dbgState);
220
221 BfTypedValue exprResult;
222 mExprEvaluator->VisitChildNoRef(mExprNode);
223
224 auto result = mExprEvaluator->mResult;
225 if ((result) && (!result.mType->IsComposite()))
226 result = module->LoadValue(result);
227
228 return result;
229}
230
231bool CeEvaluationContext::HadError()
232{

Callers 5

ParseFormatInfoMethod · 0.45
GetArrayItemsMethod · 0.45
GetLinkedListItemsMethod · 0.45
GetDictionaryItemsMethod · 0.45

Calls 8

BfTypedValueClass · 0.85
ClearErrorsMethod · 0.80
GetFrameMethod · 0.80
LoadValueMethod · 0.80
HasFailedMethod · 0.80
GetOwnerMethod · 0.45
VisitChildNoRefMethod · 0.45
IsCompositeMethod · 0.45

Tested by

no test coverage detected