| 185 | } |
| 186 | |
| 187 | BfTypedValue 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 | |
| 231 | bool CeEvaluationContext::HadError() |
| 232 | { |
no test coverage detected