This class represents a compiled script. It's not directly callable though. You'll need to Instance an object (and cast to whatever baseType used) using the Instance method and can then call methods on that.
Public Member Functions | |
NitroCode () | |
NitroCode (string code) | |
Creates a new NitroCode with the given nitro code to compile. Uses the default security manager and derives Nitro.Script. More... | |
NitroCode (string code, Type baseType) | |
Creates a new NitroCode with the given nitro code and type to derive from. Uses the default security manager. More... | |
NitroCode (NitroDomainManager manager) | |
Creates a new NitroCode with the given security manager. You'll need to call Nitro.NitroCode.Compile manually. More... | |
NitroCode (string code, NitroDomainManager manager) | |
Creates a new NitroCode with the given nitro code and security manager. More... | |
NitroCode (string code, Type baseType, NitroDomainManager manager) | |
Creates a new NitroCode with the given nitro code, type to derive from and security manager. More... | |
NitroCode (string code, Type baseType, NitroDomainManager manager, string aotFile, string aotAssemblyName) | |
Creates a new NitroCode with the given nitro code, type to derive from and security manager. More... | |
void | Compile (string code, Type baseType) |
Compiles the given code now deriving from the given object. More... | |
void | Compile (string code, Type baseType, string aotFile, string aotAssemblyName) |
Compiles the given code now deriving from the given object. More... | |
void | AddReference (CodeFragment usingName) |
Adds a reference which is named in the given fragment. Using name; is handled here. More... | |
bool | AllowUse (Type ofType) |
Checks if a type is allowed to be used. More... | |
bool | ContainsMethod (string name) |
Checks if this code contains a method with the given name. More... | |
bool | ContainsField (string field) |
Checks if this code contains a field with the given name. More... | |
Type | GetType (string name) |
Searches for the system type with the given name by first performing an alias lookup. More... | |
List< Type > | GetTypes (string name) |
Searches for all the types with the given name by first performing an alias lookup. More... | |
CompiledClass | GetClass (Type type) |
Attempts to get a CompiledClass object from its system type. More... | |
CompiledClass | GetClass (string name) |
Attempts to get a CompiledClass object from its class name. More... | |
object | Instance () |
Instances this code as an object which can have methods called upon it. If you defined a baseType in the NitroCode objects constructor, cast the result of this to that type. Otherwise, you can cast it to a Nitro.Script object which makes calling the methods easier. More... | |
Static Public Member Functions | |
static void | Setup () |
Sets up the compiler. More... | |
Public Attributes | |
string | Code |
The raw code to compile. More... | |
ModuleBuilder | Builder |
The builder that creates this script. More... | |
Static Public Attributes | |
static bool | AotMode =true |
True if variable resolving is done AOT. This generally speeds up development with Nitro, but isn't compatible with typical JS. Flip this with "use aot"; and "use jit"; More... | |
static int | ModuleCounter |
A counter for how many scripts have been compiled. Used to generate a unique module name. More... | |
static AotFileEvent | OnAotFileExists |
Called when the AOT file we want to write to already exists. More... | |
Properties | |
CompiledClass | MainClass [get] |
The main class of this code. More... | |
Type | OutputType [get] |
The compiled useable type of the object returned by Instance. More... | |
Private Member Functions | |
string | ParseReference (CodeFragment usingName) |
Retrieves a section of the reference from the given fragment. This is required as a reference is likely to be a chain of property fragments which must be followed to retrieve the full reference. More... | |
void | FindClasses (CodeFragment frag) |
Finds all classes within the given code fragment, identified with 'class'. More... | |
Private Attributes | |
Type | CompiledType |
The fully compiled type. Must call Instance to make use of it. More... | |
CompiledClass | BaseClass |
The class to derive from. More... | |
List< CodeReference > | References |
The set of referenced assemblies from the top of this script file. More... | |
NitroDomainManager | ScriptDomainManager |
The security domain manager which defines what the code can access. More... | |
Dictionary< string, CompiledClass > | Types =new Dictionary<string,CompiledClass>() |
A set of all compiled classes defined within the code. More... | |
Static Private Attributes | |
static bool | Started |
True if Setup has been called. More... | |
|
inline |
|
inline |
Creates a new NitroCode with the given nitro code to compile. Uses the default security manager and derives Nitro.Script.
code | The code to compile. |
|
inline |
Creates a new NitroCode with the given nitro code and type to derive from. Uses the default security manager.
code | The code to compile. |
baseType | The type that the compiled code will inherit. This is the type to cast Nitro.NitroCode.Instance to. |
|
inline |
Creates a new NitroCode with the given security manager. You'll need to call Nitro.NitroCode.Compile manually.
manager | The security manager which defines what the code can access. |
|
inline |
Creates a new NitroCode with the given nitro code and security manager.
code | The code to compile. |
manager | The security manager which defines what the code can access. |
|
inline |
Creates a new NitroCode with the given nitro code, type to derive from and security manager.
code | The code to compile. |
baseType | The type that the compiled code will inherit. This is the type to cast Nitro.NitroCode.Instance to. |
manager | The security manager which defines what the code can access. |
|
inline |
Creates a new NitroCode with the given nitro code, type to derive from and security manager.
code | The code to compile. |
baseType | The type that the compiled code will inherit. This is the type to cast Nitro.NitroCode.Instance to. |
manager | The security manager which defines what the code can access. |
aotFile | A DLL path to write the compiled code to (For e.g. AOT compilation). |
|
inline |
Adds a reference which is named in the given fragment. Using name; is handled here.
usingName | The fragment containing the reference. |
|
inline |
Checks if a type is allowed to be used.
ofType | The type to check for clearance. |
|
inline |
Compiles the given code now deriving from the given object.
code | The code to compile |
baseType | The type to inherit from. If null, the code will inherit from the default Script type. |
|
inline |
Compiles the given code now deriving from the given object.
code | The code to compile |
baseType | The type to inherit from. If null, the code will inherit from the default Script type. |
aotFile | A DLL path to write the compiled code to (For e.g. AOT compilation). |
|
inline |
Checks if this code contains a field with the given name.
field | The field name to search for. |
|
inline |
Checks if this code contains a method with the given name.
name | The method name to search for. |
|
inlineprivate |
Finds all classes within the given code fragment, identified with 'class'.
frag | The fragment to search. |
|
inline |
Attempts to get a CompiledClass object from its system type.
type | The system type to look for. |
|
inline |
Attempts to get a CompiledClass object from its class name.
name | The name of the class to look for. |
|
inline |
Searches for the system type with the given name by first performing an alias lookup.
name | The type name to search for. |
|
inline |
Searches for all the types with the given name by first performing an alias lookup.
name | The type name to search for. |
|
inline |
Instances this code as an object which can have methods called upon it. If you defined a baseType in the NitroCode objects constructor, cast the result of this to that type. Otherwise, you can cast it to a Nitro.Script object which makes calling the methods easier.
|
inlineprivate |
Retrieves a section of the reference from the given fragment. This is required as a reference is likely to be a chain of property fragments which must be followed to retrieve the full reference.
usingName | The current fragment to handle. |
|
inlinestatic |
Sets up the compiler.
|
static |
True if variable resolving is done AOT. This generally speeds up development with Nitro, but isn't compatible with typical JS. Flip this with "use aot"; and "use jit";
|
private |
The class to derive from.
ModuleBuilder Nitro.NitroCode.Builder |
The builder that creates this script.
string Nitro.NitroCode.Code |
The raw code to compile.
|
private |
The fully compiled type. Must call Instance to make use of it.
|
static |
A counter for how many scripts have been compiled. Used to generate a unique module name.
|
static |
Called when the AOT file we want to write to already exists.
|
private |
The set of referenced assemblies from the top of this script file.
|
private |
The security domain manager which defines what the code can access.
|
staticprivate |
True if Setup has been called.
|
private |
A set of all compiled classes defined within the code.
|
get |
The main class of this code.
|
get |
The compiled useable type of the object returned by Instance.