internal static Property CreateProperty(Class declaringType, string name, Method getMethod, Method setMethod) { Property property = new Property(); property.DeclaringClass = declaringType; property.Name = name; property.GetMethod = getMethod; property.SetMethod = setMethod; declaringType.Properties.Push(property); return property; }
internal static Method CreateMethod(Class declaringType, string name, NativeFunction function, int vtableSlot) { Method method = new Method(); method.Name = name; method.Function = function; method.VTableSlot = vtableSlot; if (function != null) { function["m"] = var.Cast<Method>(method); } method.DeclaringClass = declaringType; declaringType.Methods.Push(method); return method; }
// TODO: This is a temp hack for property getters and setters!! public static object TrampolineInvokeMethod(Method method, object self, object[] args) { if (method.Function != null) { TempHackGenerateCodeForTrampolineInvokeMethod(method.Function, self, args); } else { if (method.DeclaringClass.IsInterface) { if(method.VTableSlot == -1) { // TODO: Throw MissingMethodException throw new ExecutionEngineException("No vtable slot!"); } TempHackGenerateCodeForTrampolineInvokeInterfaceMethod(self, method.DeclaringClass.VTableDataPointer, method.VTableSlot, args); } throw new NotImplementedException("Method invocation through reflection is not yet implemented. Though, the temp property hack is in place!"); } // we should never get here! throw new ExecutionEngineException("Trampoline for method " + method + " failed"); }
internal static CustomAttribute CreateCustomAttribute(ICustomAttributeProvider attributeProvider, Method constructor) { CustomAttribute attribute = new CustomAttribute(); attribute.Constructor = constructor; attributeProvider.CustomAttributes.Push(attribute); return attribute; }
public RuntimeMethodInfo(Method method, RuntimeType declaringType) { _method = method; _declaringType = declaringType; }