Represents a class being compiled from a nitro code string.
Public Member Functions | |
CompiledClass () | |
Creates a new class. Note you must call StartType manually. More... | |
CompiledClass (CodeFragment classFragment, NitroCode script, string name, Type baseType, bool isPublic) | |
void | StartType (string name, NitroCode script, Type baseType) |
Starts creating this class. More... | |
Type | GetAsType () |
Gets this class as a system type. More... | |
void | Compile () |
Compiles this class from its ClassFragment. More... | |
bool | ContainsMethod (string name) |
Checks if this class contains the method with the given name. More... | |
bool | ContainsField (string field) |
Checks if this class contains the field with the given name. More... | |
Type | MethodReturnType (string name) |
Gets the return type of a given method by name. Note all overloads must return the same thing. More... | |
MethodInfo | FindMethodOverload (string name, CompiledFragment[] arguments) |
Gets a particular method (it may be overloaded) from this class. More... | |
MethodInfo | FindMethodOverload (string name, Type[] arguments) |
Gets a particular method (it may be overloaded) from this class. More... | |
MethodOverloads | FindMethodSet (string name) |
Finds the overload set for the method with the given name. More... | |
PropertyInfo | GetProperty (string name) |
Gets the property from this class with the given name. More... | |
FieldInfo | GetField (string name) |
Gets the field from this class with the given name. More... | |
void | FindProperties (CodeFragment fragment) |
Finds properties in the given fragment. More... | |
void | FindMethods (CodeFragment fragment) |
Finds methods within the given fragment by looking for 'function'. More... | |
Public Attributes | |
Type | BaseType |
The type that this class derives from, if any. More... | |
Type | compiledType |
When fully compiled, this is the resulting system type of this class. More... | |
NitroCode | Script |
The script this class belongs to. More... | |
bool | IsPublic =true |
True if this is a public class, false for private. More... | |
TypeBuilder | Builder |
The type builder used to construct a system type from this class. More... | |
CodeFragment | ClassFragment |
The content of this whole class as parsed from the code. More... | |
Dictionary< string, FieldInfo > | Fields =new Dictionary<string,FieldInfo>() |
All the fields of this class. More... | |
Dictionary< string, MethodOverloads > | Methods =new Dictionary<string,MethodOverloads>() |
All methods contained by this class grouped into overloads. More... | |
Protected Member Functions | |
virtual void | DefineField (string name, VariableFragment nameFragment, bool isPublic, ref CodeFragment defaultValue) |
Defines a new field on this class. More... | |
virtual CodeFragment | AddFoundMethod (CodeFragment fragment, CodeFragment body, string name, bool anonymous, BracketFragment parameters, TypeFragment returnType, int line, bool isPublic) |
Adds a method that was found into this classes set of methods to compile. More... | |
Protected Attributes | |
int | AnonymousCount |
A counter used to name anonymous methods. More... | |
Private Member Functions | |
MethodOverloads | MakeOrFind (string name, Type returnType) |
Finds the method overload set with the given name and creates it if it doesn't exist. More... | |
CompiledMethod | GetStartMethod () |
Gets the OnScriptReady method. May create it if it's not available. More... | |
CompiledMethod | GetInit () |
Gets the init method. May create it if it's not already available. More... | |
|
inline |
Creates a new class. Note you must call StartType manually.
|
inline |
|
inlineprotectedvirtual |
Adds a method that was found into this classes set of methods to compile.
fragment | The first fragment of the method, used for generating errors. This gives a valid line number. |
body | The block of code for this method. |
name | The name of the method. Null if anonymous is true. |
anonymous | True if this method is an anonymous one and requires a name. |
parameters | The set of parameters for this method. |
returnType | The type that this method returns. |
line | The line number of the method. |
isPublic | True if this is a public method; false for private. |
|
inline |
Compiles this class from its ClassFragment.
|
inline |
Checks if this class contains the field with the given name.
field | The name of the field to look for. |
|
inline |
Checks if this class contains the method with the given name.
name | The name of the method to look for. |
|
inlineprotectedvirtual |
Defines a new field on this class.
name | The name of the field. |
type | The type of the value held by this field. |
|
inline |
Gets a particular method (it may be overloaded) from this class.
name | The name of the method. |
<param name=arguments">The set of arguments being used in calling this method.
|
inline |
Gets a particular method (it may be overloaded) from this class.
name | The name of the method. |
<param name=arguments">The types of the set of arguments being used in calling this method.
|
inline |
Finds methods within the given fragment by looking for 'function'.
fragment | The fragment to search. |
|
inline |
Finds the overload set for the method with the given name.
name | The name of the method. |
|
inline |
Finds properties in the given fragment.
fragment | The fragment to search. |
|
inline |
Gets this class as a system type.
|
inline |
Gets the field from this class with the given name.
name | The name to look for. |
|
inlineprivate |
Gets the init method. May create it if it's not already available.
|
inline |
Gets the property from this class with the given name.
name | The name to look for. |
|
inlineprivate |
Gets the OnScriptReady method. May create it if it's not available.
|
inlineprivate |
Finds the method overload set with the given name and creates it if it doesn't exist.
name | The name of the method. |
returnType | The type that this method returns. |
|
inline |
Gets the return type of a given method by name. Note all overloads must return the same thing.
Starts creating this class.
name | The name of the class. |
script | The parent script this class belongs to. |
baseType | The type that this class will derive from. |
|
protected |
A counter used to name anonymous methods.
Type Nitro.CompiledClass.BaseType |
The type that this class derives from, if any.
TypeBuilder Nitro.CompiledClass.Builder |
The type builder used to construct a system type from this class.
CodeFragment Nitro.CompiledClass.ClassFragment |
The content of this whole class as parsed from the code.
Type Nitro.CompiledClass.compiledType |
When fully compiled, this is the resulting system type of this class.
Dictionary<string,FieldInfo> Nitro.CompiledClass.Fields =new Dictionary<string,FieldInfo>() |
All the fields of this class.
bool Nitro.CompiledClass.IsPublic =true |
True if this is a public class, false for private.
Dictionary<string,MethodOverloads> Nitro.CompiledClass.Methods =new Dictionary<string,MethodOverloads>() |
All methods contained by this class grouped into overloads.
NitroCode Nitro.CompiledClass.Script |
The script this class belongs to.