public static JSValue _DynamicMethodInvoke(JSContext ctx, JSValue this_obj, int argc, JSValue[] argv, int magic) { var typeDB = ScriptEngine.GetTypeDB(ctx); if (typeDB == null) { return(JSApi.JS_ThrowInternalError(ctx, "type db is null")); } var method = typeDB.GetDynamicMethod(magic); if (method != null) { try { return(method.Invoke(ctx, this_obj, argc, argv)); } catch (Exception exception) { return(JSApi.ThrowException(ctx, exception)); } } return(JSApi.JS_ThrowInternalError(ctx, "dynamic method not found")); }
public static JSValue _DynamicFieldSetter(JSContext ctx, JSValue this_obj, JSValue val, int magic) { var typeDB = ScriptEngine.GetTypeDB(ctx); if (typeDB == null) { return(JSApi.JS_ThrowInternalError(ctx, "type db is null")); } var field = typeDB.GetDynamicField(magic); if (field != null) { try { return(field.SetValue(ctx, this_obj, val)); } catch (Exception exception) { return(JSApi.ThrowException(ctx, exception)); } } return(JSApi.JS_ThrowInternalError(ctx, "dynamic field not found")); }