C# Class Mono.CSharp.TypeInfo

This is used by the flow analysis code to keep track of the type of local variables and variables. The flow code uses a BitVector to keep track of whether a variable has been assigned or not. This is easy for fundamental types (int, char etc.) or reference types since you can only assign the whole variable as such. For structs, we also need to keep track of all its fields. To do this, we allocate one bit for the struct itself (it's used if you assign/access the whole struct) followed by one bit for each of its fields. This class computes this `layout' for each type.
Show file Open project: vargaz/mono Class Usage Examples

Public Properties

Property Type Description
IsStruct bool
Length int
Offset int
SubStructInfo TypeInfo[]
TotalLength int

Public Methods

Method Description
GetFieldIndex ( string name ) : int
GetStructField ( string name ) : TypeInfo
GetTypeInfo ( System.TypeSpec type, IMemberContext context ) : TypeInfo
IsFullyInitialized ( Mono.CSharp.FlowAnalysisContext fc, VariableInfo vi, Mono.CSharp.Location loc ) : bool

A struct's constructor must always assign all fields. This method checks whether it actually does so.

Reset ( ) : void
ToString ( ) : string

Private Methods

Method Description
TypeInfo ( ) : System
TypeInfo ( StructInfo struct_info, int offset ) : System
TypeInfo ( int totalLength ) : System

Method Details

GetFieldIndex() public method

public GetFieldIndex ( string name ) : int
name string
return int

GetStructField() public method

public GetStructField ( string name ) : TypeInfo
name string
return TypeInfo

GetTypeInfo() public static method

public static GetTypeInfo ( System.TypeSpec type, IMemberContext context ) : TypeInfo
type System.TypeSpec
context IMemberContext
return TypeInfo

IsFullyInitialized() public method

A struct's constructor must always assign all fields. This method checks whether it actually does so.
public IsFullyInitialized ( Mono.CSharp.FlowAnalysisContext fc, VariableInfo vi, Mono.CSharp.Location loc ) : bool
fc Mono.CSharp.FlowAnalysisContext
vi VariableInfo
loc Mono.CSharp.Location
return bool

Reset() public static method

public static Reset ( ) : void
return void

ToString() public method

public ToString ( ) : string
return string

Property Details

IsStruct public property

If this is a struct.
public bool IsStruct
return bool

Length public property

Number of bits the simple fields of a variable of this type consume in the flow vector.
public int Length
return int

Offset public property

This is only used by sub-structs.
public int Offset
return int

SubStructInfo public property

If this is a struct, all fields which are structs theirselves.
public TypeInfo[] SubStructInfo
return TypeInfo[]

TotalLength public property

Total number of bits a variable of this type consumes in the flow vector.
public int TotalLength
return int