1using System.Reflection;
19 private readonly List<MethodInfo>
m_Methods =
new List<MethodInfo>();
50 bool isStatic = instance ==
null;
53 args =>
Invoke(instance, args),
70 object? obj = o.Unwrap();
75 return !t.IsValueType;
78 return t.IsInstanceOfType(obj) ||
90 object obj = ro.Instance;
92 return t.IsInstanceOfType(obj);
126 if (t.IsInstanceOfType(obj))
131 if (t.IsNumericType())
133 return Convert.ChangeType(obj, t);
147 private object?[]
FindImplementation(
object? instance, IReadOnlyList<BadObject> args, out MethodInfo info)
151 if ((instance ==
null && !method.IsStatic) || (instance !=
null && method.IsStatic))
156 ParameterInfo[] parameters = method.GetParameters();
158 if (parameters.Length != args.Count)
163 object?[] converted =
new object?[args.Count];
164 bool skipThis =
false;
166 for (
int i = 0; i < parameters.Length; i++)
168 ParameterInfo parameter = parameters[i];
171 if (!
CanConvert(argument, parameter.ParameterType))
178 converted[i] =
ConvertObject(argument, parameter.ParameterType);
204 return Wrap(info.Invoke(instance, implArgs));
Gets thrown by the runtime.
Interop Function taking an array of arguments.
Implements a Reflected Object.
Implements a Reflected Member.
string Name
The Name of the Member.
static BadObject Wrap(object? o)
Wraps an Object into a BadObject.
Implements a Reflected Method Member.
static ? object ConvertObject(BadObject o, Type t)
Converts the given Object to the given Type.
override BadObject Get(object? instance)
void AddMethod(MethodInfo method)
Adds a Method to the Reflected Method.
BadReflectedMethod(MethodInfo method)
Creates a new BadReflectedMethod.
static bool CanConvert(BadObject o, Type t)
Indicates if the given Object can be converted to the given Type.
BadFunction CreateFunction(object? instance)
Creates a new Function for the Reflected Method.
readonly List< MethodInfo > m_Methods
The Reflected Methods.
BadObject Invoke(object? instance, BadObject[] args)
Invokes the Method with the given Arguments.
object?[] FindImplementation(object? instance, IReadOnlyList< BadObject > args, out MethodInfo info)
Finds the Implementation of the Method that matches the given Arguments.
override void Set(object? instance, BadObject o)
The Base Class for all BadScript Objects.
Implements a function that can be called from the script.
Provides function parameter info.
The Any Prototype, Base type for all types.
static readonly BadAnyPrototype Instance
The Instance of the BadAnyPrototype.
Contains the Error Objects for the BadScript2 Language.
Contains the Interop Function Classes for the BadScript2 Language.
Contains the Member Classes for Reflection Objects.
Contains Runtime Function Objects.
Contains Runtime Type Objects.
Contains the Runtime Objects.