Table of Contents

Class CastOpCodeHandlerBase

Namespace
Echo.Platforms.AsmResolver.Emulation.Dispatch.ObjectModel
Assembly
Echo.Platforms.AsmResolver.dll

Provides a base for instructions implementing type-casting and boxing behavior.

public abstract class CastOpCodeHandlerBase : FallThroughOpCodeHandler, ICilOpCodeHandler
Inheritance
CastOpCodeHandlerBase
Implements
Derived
Inherited Members

Methods

DispatchInternal(CilExecutionContext, CilInstruction)

Evaluates a CIL instruction in the provided execution context, without increasing the program counter.

protected override CilDispatchResult DispatchInternal(CilExecutionContext context, CilInstruction instruction)

Parameters

context CilExecutionContext

The context to evaluate the instruction in.

instruction CilInstruction

The instruction to dispatch and evaluate.

Returns

CilDispatchResult

A value indicating whether the dispatch was successful or caused an error.

HandleFailedCast(CilExecutionContext, TypeSignature, TypeSignature)

Handles the case when the pushed value is incompatible with the type specified in the instruction.

protected virtual CilDispatchResult HandleFailedCast(CilExecutionContext context, TypeSignature originalType, TypeSignature targetType)

Parameters

context CilExecutionContext

The context to evaluate the instruction in.

originalType TypeSignature

The type of the pushed object.

targetType TypeSignature

The type that the object was attempted to be converted to.

Returns

CilDispatchResult

The final dispatcher result.

HandleNull(CilExecutionContext, TypeSignature)

Handles the case when the pushed value is null.

protected virtual CilDispatchResult HandleNull(CilExecutionContext context, TypeSignature targetType)

Parameters

context CilExecutionContext

The context to evaluate the instruction in.

targetType TypeSignature

The type to convert the null reference to.

Returns

CilDispatchResult

The final dispatcher result.

HandleSuccessfulCast(CilExecutionContext, ObjectHandle, TypeSignature)

Handles the case when the pushed value is compatible with the type specified in the instruction.

protected abstract CilDispatchResult HandleSuccessfulCast(CilExecutionContext context, ObjectHandle handle, TypeSignature targetType)

Parameters

context CilExecutionContext

The context to evaluate the instruction in.

handle ObjectHandle

The address of the object.

targetType TypeSignature

The type to convert the object to to.

Returns

CilDispatchResult

The final dispatcher result.