Represents a method/function that is currently being compiled.
Public Member Functions | |
CompiledMethod (string name) | |
CompiledMethod (CompiledClass parent, string name, BracketFragment parameterBlock, BracketFragment codeBlock, TypeFragment retType, int line, bool isPublic) | |
void | AddBreakPoint (BreakPoint bp) |
Adds a breakpoint to the set of breakpoints for this method. More... | |
void | PopBreakPoint () |
Removes a breakpoint from the set of breakpoints for this method. More... | |
bool | Break (NitroIL into, int depth) |
Adds a break into the given IL stream, breaking out of the given number of loops. More... | |
bool | Continue (NitroIL into, int depth) |
Adds a continue into the given IL stream, continuing at the given number of loops up. More... | |
void | Done () |
Called when this method is finished compiling this method. More... | |
void | Error (string message) |
Throws an error that occured in the compilation of this method with the given message. More... | |
Type | ReturnType () |
Gets the return type of this method. More... | |
MethodInfo | getMethodInfo () |
Gets the MethodInfo for this method. More... | |
ParameterVariable | GetParameter (string variableName) |
Attempts to find the parameter by the given name. More... | |
LocalVariable | GetLocal (string variableName) |
Attempts to find the local variable by the given name. More... | |
LocalVariable | GetLocal (string variableName, bool create, Type createType) |
Attempts to find the local by the given name and optionally creates it if it's not found. More... | |
Variable | GetVariable (string name) |
Attempts to get either a local variable or a parameter by the given name. More... | |
Variable | GetVariable (string name, bool create, Type createType) |
Attempts to get either a local variable or a parameter by the given name, creating it if not found. More... | |
Variable | GetVariable (string name, VariableType type, bool create, Type createType) |
Attempts to get either a variable of the given type by the given name, creating it if not found. More... | |
Public Attributes | |
int | Line |
The line the method starts on. More... | |
string | Name |
The name of the method. More... | |
NitroCode | Script |
The script that this method belongs to. More... | |
NitroIL | ILStream |
The IL stream for this method. This is what will make this method executable. More... | |
Label | EndOfMethod |
The location at the end of the method. More... | |
bool | GloballyScoped |
True if any variables in this method should be declared on the class. More... | |
CompiledClass | Parent |
The class that this method belongs to. More... | |
bool | ParametersLoaded |
True if the parameter types have been parsed. More... | |
MethodBuilder | Builder |
A method builder which provides the ILGenerator. More... | |
Type[] | ParameterTypes |
The types of each parameter that this method accepts. More... | |
LocalBuilder | ReturnBay |
A location that the return value is placed into. More... | |
BracketFragment | CodeBlock |
The block of code that represents the body of this method. More... | |
BracketFragment | ParameterBlock |
The bracket fragment that contains the set of parameters. More... | |
CompiledFragment[] | DefaultParameterValues |
Default values for the parameters, if any are provided. More... | |
List< BreakPoint > | BreakPoints =new List<BreakPoint>() |
A list which acts like a stack of breakpoints for breaking from nested loops. More... | |
Dictionary< string, LocalVariable > | LocalSet =new Dictionary<string,LocalVariable>() |
A fast lookup of variable name to local variable. More... | |
Dictionary< string, ParameterVariable > | ParameterSet =new Dictionary<string,ParameterVariable>() |
A fast lookup of variable name to parameter variable. More... | |
Private Member Functions | |
void | ParametersOk () |
Confirms that the recently loaded parameters are valid. More... | |
void | ParseParameters () |
Loads the parameter block into a set of types. More... | |
void | ApplyParameters () |
|
inline |
|
inline |
|
inline |
Adds a breakpoint to the set of breakpoints for this method.
bp | The breakpoint to add. |
|
inlineprivate |
|
inline |
Adds a break into the given IL stream, breaking out of the given number of loops.
into | The IL stream to emit the break into. |
depth | The amount of loops to break from. Can be affected with e.g. break 2; for getting out of a loop in a loop. |
|
inline |
Adds a continue into the given IL stream, continuing at the given number of loops up.
into | The IL stream to emit the continue into. |
depth | The loop to continue in. Can be affected with e.g. continue 2; for continuing the outer loop of a loop in a loop. |
|
inline |
Called when this method is finished compiling this method.
|
inline |
Throws an error that occured in the compilation of this method with the given message.
message | A message to state why this error occured. |
|
inline |
Attempts to find the local variable by the given name.
variableName | The name of the local variable to find. |
|
inline |
Attempts to find the local by the given name and optionally creates it if it's not found.
variableName | The name of the local to find. |
create | True if it should be created if not found. |
createType | If create is true, the type of the variable to create. If it's null, object is assumed. |
|
inline |
Gets the MethodInfo for this method.
|
inline |
Attempts to find the parameter by the given name.
variableName | The name of the parameter to find. |
|
inline |
Attempts to get either a local variable or a parameter by the given name.
name | The name of the variable to find. |
Attempts to get either a local variable or a parameter by the given name, creating it if not found.
name | The name of the variable to find. |
create | True if it should be created if not found. Will always make a local. |
createType | If create is true, the type of the variable to create. If it's null, object is assumed. |
|
inline |
Attempts to get either a variable of the given type by the given name, creating it if not found.
name | The name of the variable to find. |
type | The type of the variable to find. Local, Parameter or Any. |
create | True if it should be created if not found. Will always make a local. |
createType | If create is true, the type of the variable to create. If it's null, object is assumed. |
|
inlineprivate |
Confirms that the recently loaded parameters are valid.
|
inlineprivate |
Loads the parameter block into a set of types.
|
inline |
Removes a breakpoint from the set of breakpoints for this method.
|
inline |
Gets the return type of this method.
List<BreakPoint> Nitro.CompiledMethod.BreakPoints =new List<BreakPoint>() |
A list which acts like a stack of breakpoints for breaking from nested loops.
MethodBuilder Nitro.CompiledMethod.Builder |
A method builder which provides the ILGenerator.
BracketFragment Nitro.CompiledMethod.CodeBlock |
The block of code that represents the body of this method.
CompiledFragment [] Nitro.CompiledMethod.DefaultParameterValues |
Default values for the parameters, if any are provided.
Label Nitro.CompiledMethod.EndOfMethod |
The location at the end of the method.
bool Nitro.CompiledMethod.GloballyScoped |
True if any variables in this method should be declared on the class.
NitroIL Nitro.CompiledMethod.ILStream |
The IL stream for this method. This is what will make this method executable.
int Nitro.CompiledMethod.Line |
The line the method starts on.
Dictionary<string,LocalVariable> Nitro.CompiledMethod.LocalSet =new Dictionary<string,LocalVariable>() |
A fast lookup of variable name to local variable.
string Nitro.CompiledMethod.Name |
The name of the method.
BracketFragment Nitro.CompiledMethod.ParameterBlock |
The bracket fragment that contains the set of parameters.
Dictionary<string,ParameterVariable> Nitro.CompiledMethod.ParameterSet =new Dictionary<string,ParameterVariable>() |
A fast lookup of variable name to parameter variable.
bool Nitro.CompiledMethod.ParametersLoaded |
True if the parameter types have been parsed.
Type [] Nitro.CompiledMethod.ParameterTypes |
The types of each parameter that this method accepts.
CompiledClass Nitro.CompiledMethod.Parent |
The class that this method belongs to.
LocalBuilder Nitro.CompiledMethod.ReturnBay |
A location that the return value is placed into.
NitroCode Nitro.CompiledMethod.Script |
The script that this method belongs to.