Detailed Description

This is the heart of Nitro. A debuggable IL stream that all nitro outputs IL into. It is essentially a wrapper for the ILGenerator class, enabling the output to be logged. It will automatically log its content by setting defining an 'ildebug' compile time variable.

Public Member Functions

 NitroIL (ILGenerator generator)
 Creates a new Nitro IL generator with the given system ILGenerator. More...
 
void Output (string line)
 Outputs the given textual string to the DebugOutput variable, appending a line number. More...
 
Label DefineLabel ()
 Defines a label that marks a position in the IL. More...
 
void MarkLabel (Label label)
 Marks the location of the given label in the IL. More...
 
void Emit (OpCode opcode)
 Adds the specified instruction into the IL. More...
 
void Emit (OpCode opcode, LocalBuilder builder)
 Adds the specified instruction and the local field into the IL. More...
 
void Emit (OpCode opcode, ConstructorInfo constructor)
 Adds the specified instruction and the given constructor to call into the IL. More...
 
void Emit (OpCode opcode, MethodInfo method)
 Adds the specified instruction and the given method to call into the IL. More...
 
void Emit (OpCode opcode, FieldInfo field)
 Adds the specified instruction and the given field into the IL. More...
 
void Emit (OpCode opcode, byte value)
 Adds the specified instruction and numerical argument into the IL. More...
 
void Emit (OpCode opcode, sbyte value)
 Adds the specified instruction and numerical argument into the IL. More...
 
void Emit (OpCode opcode, double value)
 Adds the specified instruction and numerical argument into the IL. More...
 
void Emit (OpCode opcode, float value)
 Adds the specified instruction and numerical argument into the IL. More...
 
void Emit (OpCode opcode, short value)
 Adds the specified instruction and numerical argument into the IL. More...
 
void Emit (OpCode opcode, int value)
 Adds the specified instruction and numerical argument into the IL. More...
 
void Emit (OpCode opcode, long value)
 Adds the specified instruction and numerical argument into the IL. More...
 
void Emit (OpCode opcode, string value)
 Adds the specified instruction and textual argument into the IL. More...
 
void Emit (OpCode opcode, Type type)
 Adds the specified instruction and system type argument into the IL. More...
 
void Emit (OpCode opcode, Label label)
 Adds the specified instruction and label argument into the IL. E.g. for jump operations. More...
 
LocalBuilder DeclareLocal (Type localType)
 Creates a new local variable with the specified system type. More...
 
void Done (string message)
 Done is called when this IL stream is completed. When debug is active, it automatically logs the DebugOutput. More...
 

Public Attributes

int ILLine
 If debugging is active, this is simply a counter used to track the line number. More...
 
string DebugOutput
 The debugging output as a string, if debugging is active. More...
 
ILGenerator Generator
 The internal ILGenerator that all IL will actually be emitted to. More...
 

Constructor & Destructor Documentation

Nitro.NitroIL.NitroIL ( ILGenerator  generator)
inline

Creates a new Nitro IL generator with the given system ILGenerator.

Parameters
generatorThe system ILGenerator that this class will output all IL to.

Member Function Documentation

LocalBuilder Nitro.NitroIL.DeclareLocal ( Type  localType)
inline

Creates a new local variable with the specified system type.

Parameters
localTypeThe type of the value this variable will hold.
Returns
A new local builder.
Label Nitro.NitroIL.DefineLabel ( )
inline

Defines a label that marks a position in the IL.

Returns
A new label.
void Nitro.NitroIL.Done ( string  message)
inline

Done is called when this IL stream is completed. When debug is active, it automatically logs the DebugOutput.

Parameters
messageAn extra message to add to the output.
void Nitro.NitroIL.Emit ( OpCode  opcode)
inline

Adds the specified instruction into the IL.

Parameters
opcodeThe instruction to add.
void Nitro.NitroIL.Emit ( OpCode  opcode,
LocalBuilder  builder 
)
inline

Adds the specified instruction and the local field into the IL.

Parameters
opcodeThe instruction to add.
builderThe local builder that should be outputted into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
ConstructorInfo  constructor 
)
inline

Adds the specified instruction and the given constructor to call into the IL.

Parameters
opcodeThe instruction to add.
constructorThe constructor info that should be outputted into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
MethodInfo  method 
)
inline

Adds the specified instruction and the given method to call into the IL.

Parameters
opcodeThe instruction to add.
methodThe method info that should be outputted into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
FieldInfo  field 
)
inline

Adds the specified instruction and the given field into the IL.

Parameters
opcodeThe instruction to add.
fieldThe field that should be outputted into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
byte  value 
)
inline

Adds the specified instruction and numerical argument into the IL.

Parameters
opcodeThe instruction to add.
valueA numerical argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
sbyte  value 
)
inline

Adds the specified instruction and numerical argument into the IL.

Parameters
opcodeThe instruction to add.
valueA numerical argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
double  value 
)
inline

Adds the specified instruction and numerical argument into the IL.

Parameters
opcodeThe instruction to add.
valueA numerical argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
float  value 
)
inline

Adds the specified instruction and numerical argument into the IL.

Parameters
opcodeThe instruction to add.
valueA numerical argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
short  value 
)
inline

Adds the specified instruction and numerical argument into the IL.

Parameters
opcodeThe instruction to add.
valueA numerical argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
int  value 
)
inline

Adds the specified instruction and numerical argument into the IL.

Parameters
opcodeThe instruction to add.
valueA numerical argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
long  value 
)
inline

Adds the specified instruction and numerical argument into the IL.

Parameters
opcodeThe instruction to add.
valueA numerical argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
string  value 
)
inline

Adds the specified instruction and textual argument into the IL.

Parameters
opcodeThe instruction to add.
valueA textual argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
Type  type 
)
inline

Adds the specified instruction and system type argument into the IL.

Parameters
opcodeThe instruction to add.
valueA system type argument to add into the IL.
void Nitro.NitroIL.Emit ( OpCode  opcode,
Label  label 
)
inline

Adds the specified instruction and label argument into the IL. E.g. for jump operations.

Parameters
opcodeThe instruction to add.
valueA label argument to add into the IL.
void Nitro.NitroIL.MarkLabel ( Label  label)
inline

Marks the location of the given label in the IL.

Parameters
labelThe label to locate.
void Nitro.NitroIL.Output ( string  line)
inline

Outputs the given textual string to the DebugOutput variable, appending a line number.

Parameters
lineThe line of text to add to the output.

Member Data Documentation

string Nitro.NitroIL.DebugOutput

The debugging output as a string, if debugging is active.

ILGenerator Nitro.NitroIL.Generator

The internal ILGenerator that all IL will actually be emitted to.

int Nitro.NitroIL.ILLine

If debugging is active, this is simply a counter used to track the line number.