Show / Hide Table of Contents

    Class TypeHelpers

    Defines helper methods for bridging the gap between IL's implicit reference types and Flame's explicit box pointers.

    Inheritance
    System.Object
    TypeHelpers
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Flame.Clr
    Assembly: Flame.Clr.dll
    Syntax
    public static class TypeHelpers

    Methods

    | Improve this Doc View Source

    BoxIfReferenceType(IType)

    Takes a type, examines it and boxes it if it is a raw reference type. It is appropriate to call this method on the type of a value; IL values that happen to be reference types are implicitly boxed. This function hints that this implicit boxing is to be made explicit.

    Declaration
    public static IType BoxIfReferenceType(IType type)
    Parameters
    Type Name Description
    IType type

    The type to box if it happens to be a reference type.

    Returns
    Type Description
    IType

    A box-pointer type if type is a raw reference type; otherwise, type itself.

    | Improve this Doc View Source

    BoxReferenceTypes(IType)

    Replaces all raw reference types with boxed reference types.

    Declaration
    public static IType BoxReferenceTypes(IType type)
    Parameters
    Type Name Description
    IType type

    The type to completely box.

    Returns
    Type Description
    IType

    A boxed type.

    | Improve this Doc View Source

    GetExtendedParameters(MethodDefinition)

    Gets a method's extended parameter list, consists of the method's parameter list and an optional 'this' parameter as a prefix.

    Declaration
    public static IReadOnlyList<ParameterDefinition> GetExtendedParameters(MethodDefinition method)
    Parameters
    Type Name Description
    Mono.Cecil.MethodDefinition method

    The method to examine.

    Returns
    Type Description
    System.Collections.Generic.IReadOnlyList<Mono.Cecil.ParameterDefinition>

    A list of parameters.

    | Improve this Doc View Source

    ImportReference(ModuleDefinition, IField)

    Takes a Flame field and converts it to a Cecil field reference. For this to work, field cannot reference non-Cecil types or methods.

    Declaration
    public static FieldReference ImportReference(this ModuleDefinition module, IField field)
    Parameters
    Type Name Description
    Mono.Cecil.ModuleDefinition module

    The module to import field into.

    IField field

    The field to convert to a field reference.

    Returns
    Type Description
    Mono.Cecil.FieldReference

    A field reference.

    | Improve this Doc View Source

    ImportReference(ModuleDefinition, IMethod)

    Takes a Flame method and converts it to a Cecil method reference. For this to work, method cannot reference non-Cecil types or methods.

    Declaration
    public static MethodReference ImportReference(this ModuleDefinition module, IMethod method)
    Parameters
    Type Name Description
    Mono.Cecil.ModuleDefinition module

    The module to import method into.

    IMethod method

    The method to convert to a method reference.

    Returns
    Type Description
    Mono.Cecil.MethodReference

    A method reference.

    | Improve this Doc View Source

    ImportReference(ModuleDefinition, IType)

    Takes a Flame type and converts it to a Cecil type reference. For this to work, type cannot reference non-Cecil types.

    Declaration
    public static TypeReference ImportReference(this ModuleDefinition module, IType type)
    Parameters
    Type Name Description
    Mono.Cecil.ModuleDefinition module

    The module to import type into.

    IType type

    The type to convert to a type reference.

    Returns
    Type Description
    Mono.Cecil.TypeReference

    A type reference.

    | Improve this Doc View Source

    TryGetDelegateInvokeMethod(IType, out IMethod)

    Gets the 'invoke' method of a delegate type, provided that it is indeed a delegate type.

    Declaration
    public static bool TryGetDelegateInvokeMethod(IType delegateType, out IMethod invokeMethod)
    Parameters
    Type Name Description
    IType delegateType

    A type that may be a delegate type.

    IMethod invokeMethod

    The delegate type's 'invoke' method, provided that delegateType is a delegate type with an 'invoke' method

    Returns
    Type Description
    System.Boolean

    true if delegateType is indeed a delegate type with an 'invoke' method; otherwise, false.

    | Improve this Doc View Source

    UnboxIfPossible(IType)

    Takes a type, examines it and unboxes it if it is a box pointer type.

    Declaration
    public static IType UnboxIfPossible(IType type)
    Parameters
    Type Name Description
    IType type

    The type to unbox if it happens to be a box pointer type.

    Returns
    Type Description
    IType

    type's pointee if it is a box pointer type; otherwise, type itself.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX