Global methods that relate to handling variable types and changing/ casting between them.
Static Public Member Functions | |
static bool | IsNumeric (Type type) |
True if the given type is a numeric one (e.g. a float, int etc). More... | |
static MethodInfo | GetCallable (Type type) |
Gets the Run method on the given type. More... | |
static ConstructorInfo | GetConstructor (Type type, CompiledFragment[] args) |
Gets the constructor overload for the given type and using the given arguments. More... | |
static string | SetToString (ParameterInfo[] set) |
Converts the given set of parameters into a string of name:Type, seperated by commas. More... | |
static Type[] | SetToTypes (ParameterInfo[] set) |
Converts the given set of parameters a set of types. More... | |
static bool | IsParams (ParameterInfo param) |
Checks if the given ParameterInfo uses the params keyword. More... | |
static bool | IsDynamic (MemberInfo member) |
Checks if the given member is from a class being compiled at the moment. More... | |
static int | WillAccept (Type[] args, ParameterInfo[] parameters, bool withCasting) |
Checks if the given parameter set will accept the given argument set. Used to find an overload. More... | |
static bool | NoReturn (MethodInfo methodInfo) |
Checks if the given method doesn't return anything. More... | |
static bool | IsVoid (Type T) |
Checks if the given type is either a system or nitro void. More... | |
static void | OutputParameters (CompiledFragment[] args, CompiledMethod method, NitroIL into, ParameterInfo[] parameters) |
Outputs the given argument set into the given IL stream. More... | |
static Type | MethodReturnType (Type type, string name) |
Gets the return type of a named method on the given type. Note that all overloads must return the same type in Nitro. More... | |
static MethodInfo | GetOverload (List< MethodInfo > overloads, Type[] argSet) |
Gets the MethodInfo from the given set of methods which matches the given argument set. More... | |
static MethodInfo | GetOverload (MethodInfo[] overloads, string name, Type[] argSet) |
Gets the MethodInfo from the given set of methods which matches the given argument set and name. More... | |
static MethodInfo | GetOverload (MethodInfo[] overloads, string name, Type[] argSet, bool ignoreCase) |
Gets the MethodInfo from the given set of methods which matches the given argument set and name. More... | |
static bool | TypeSetsMatch (Type[] a, Type[] b) |
Checks if A and B match. Note that types in A can derive (inherit) types in set B. More... | |
static bool | TypeSetsMatchExactly (Type[] a, Type[] b) |
Checks if the given type sets match exactly with no inheritance allowed. More... | |
static MethodOperation | ToStringMethod (CompiledMethod method, CompiledFragment frag, Type type) |
Gets the ToString method of the given type, being called on the given fragment. More... | |
static CompiledFragment | TryCast (CompiledMethod method, CompiledFragment frag, Type to, Type from) |
Attempts to generate a cast operation for the given fragment to the given type. More... | |
static CompiledFragment | TryCast (CompiledMethod method, CompiledFragment frag, Type to, Type from, out bool isExplicit) |
Attempts to generate a cast operation for the given fragment to the given type. More... | |
static string | NameWithoutNamespace (string typeName) |
Gets the name of a type without the namespace. E.g. System.Int32 becomes Int32. More... | |
static MethodInfo | IsCastableTo (Type from, Type to, out bool isExplicit) |
Checks if one type is castable to another, reporting if it must be done explicitly or not if its possible. More... | |
static Type[] | GetTypes (Type first, CompiledFragment[] frags) |
Converts a set of compiled fragments into a set of their outputted types. E.g. if a certain fragment is "a string", one of the types will be a string. More... | |
static Type[] | GetTypes (CompiledFragment[] frags) |
Converts a set of compiled fragments into a set of their outputted types. E.g. if a certain fragment is "a string", one of the types will be a string. More... | |
static bool | IsSubclass (object obj, Type super) |
Checks if the given object is a subclass of the given type. More... | |
static bool | IsTypeOf (object obj, Type super) |
Checks if the given object is a type of or derives the given type. More... | |
static bool | IsCompiled (CodeFragment obj) |
Checks if the given code fragment is a CompiledFragment. More... | |
Static Private Member Functions | |
static ConstructorInfo | GetConstructor (ConstructorInfo[] constructors, Type[] paramSet, bool withCasting) |
Searches a set of constructors for an overload that accepts the given types. More... | |
static MethodInfo | GetOverload (List< MethodInfo > overloads, Type[] argSet, bool cast) |
Gets the MethodInfo from the given set of methods which matches the given argument set. More... | |
static MethodInfo | GetOverload (MethodInfo[] overloads, string name, Type[] argSet, bool ignoreCase, bool cast) |
Gets the MethodInfo from the given set of methods which matches the given argument set and name. More... | |
|
inlinestatic |
Gets the Run method on the given type.
type | The type to get the run method for. |
|
inlinestatic |
Gets the constructor overload for the given type and using the given arguments.
type | The type to get the constructor from. |
args | The set of arguments being passed to the constructor. Used to find the right overload. |
|
inlinestaticprivate |
Searches a set of constructors for an overload that accepts the given types.
constructors | The set of constructors to search through. |
paramSet | The types of the arguments to match the overload with. |
withCasting | True if casting should be used to help find a good match. |
|
inlinestatic |
Gets the MethodInfo from the given set of methods which matches the given argument set.
overloads | The set of overloads to find the right overload from. |
argSet | The set of arguments to find a matching overload with. |
|
inlinestaticprivate |
Gets the MethodInfo from the given set of methods which matches the given argument set.
overloads | The set of overloads to find the right overload from. |
argSet | The set of arguments to find a matching overload with. |
cast | True if the search should allow casting when performing the match. |
|
inlinestatic |
Gets the MethodInfo from the given set of methods which matches the given argument set and name.
overloads | The set of overloads to find the right overload from. |
name | The name of the method to find. Note that it is case sensitive. This is used if the method set is a full set of methods from a type. |
argSet | The set of arguments to find a matching overload with. |
|
inlinestatic |
Gets the MethodInfo from the given set of methods which matches the given argument set and name.
overloads | The set of overloads to find the right overload from. |
name | The name of the method to find. This is used if the method set is a full set of methods from a type. |
argSet | The set of arguments to find a matching overload with. |
ignoreCase | Defines if the search should ignore case on the method names or not. |
|
inlinestaticprivate |
Gets the MethodInfo from the given set of methods which matches the given argument set and name.
overloads | The set of overloads to find the right overload from. |
name | The name of the method to find. This is used if the method set is a full set of methods from a type. |
argSet | The set of arguments to find a matching overload with. |
ignoreCase | Defines if the search should ignore case on the method names or not. |
cast | True if the search should allow casting when performing the match. |
|
inlinestatic |
Converts a set of compiled fragments into a set of their outputted types. E.g. if a certain fragment is "a string", one of the types will be a string.
frags | The set of fragments to convert. |
|
inlinestatic |
Converts a set of compiled fragments into a set of their outputted types. E.g. if a certain fragment is "a string", one of the types will be a string.
frags | The set of fragments to convert. |
Checks if one type is castable to another, reporting if it must be done explicitly or not if its possible.
from | The type to cast from. |
to | The type to cast to. |
isExplicit | True if the cast must be done explicity. |
|
inlinestatic |
Checks if the given code fragment is a CompiledFragment.
obj | The fragment to check. |
|
inlinestatic |
Checks if the given member is from a class being compiled at the moment.
member | The member to check. |
|
inlinestatic |
True if the given type is a numeric one (e.g. a float, int etc).
type | The type to check. |
|
inlinestatic |
Checks if the given ParameterInfo uses the params keyword.
param | The parameter to check. |
|
inlinestatic |
Checks if the given object is a subclass of the given type.
obj | The object to check. |
super | The type to compare it with. |
|
inlinestatic |
Checks if the given object is a type of or derives the given type.
obj | The object to check. |
super | The type to compare it with. |
|
inlinestatic |
Checks if the given type is either a system or nitro void.
Gets the return type of a named method on the given type. Note that all overloads must return the same type in Nitro.
type | The type to look for the method on. |
name | The name of the method to look for. |
|
inlinestatic |
Gets the name of a type without the namespace. E.g. System.Int32 becomes Int32.
typeName | The full typename, including the namespace. |
|
inlinestatic |
Checks if the given method doesn't return anything.
methodInfo | The method to check. |
|
inlinestatic |
Outputs the given argument set into the given IL stream.
args | The compiled set of arguments to be outputted. |
method | The method that they are being used in. |
into | The IL stream to output the arguments into. |
parameters | The parameter info used to correctly match the location of the parameters. |
|
inlinestatic |
Converts the given set of parameters into a string of name:Type, seperated by commas.
set | The set of parameters to turn into a string. |
|
inlinestatic |
Converts the given set of parameters a set of types.
set | The set of parameters to turn into a type set. |
|
inlinestatic |
Gets the ToString method of the given type, being called on the given fragment.
method | The function this operation is occuring in. |
frag | The object that the ToString method is being called on. |
type | The type that fragment contains and the one that the ToString operation must be found on. |
|
inlinestatic |
Attempts to generate a cast operation for the given fragment to the given type.
method | The method this operation is occuring in. |
frag | The fragment containing the object to cast. |
to | The type to cast it to if possible. |
|
inlinestatic |
Attempts to generate a cast operation for the given fragment to the given type.
method | The method this operation is occuring in. |
frag | The fragment containing the object to cast. |
to | The type to cast it to if possible. |
isExplicit | True if the casting is explicit. False if it is implicit. |
Checks if A and B match. Note that types in A can derive (inherit) types in set B.
a | The first set to match. |
b | The second set to match. |
Checks if the given type sets match exactly with no inheritance allowed.
a | The first set to match. |
b | The second set to match. |
|
inlinestatic |
Checks if the given parameter set will accept the given argument set. Used to find an overload.
args | The set of arguments. |
parameters | The set of parameters. |
withCasting | True if casting is allowed to perform the match. |