#include "boundmethod.h"
#include "../format.h"
#include "class.h"
#include "errors.h"
#include "file.h"
#include "function.h"
Value next_boundmethod_str(const Value *args, int numargs) {
(void)numargs;
EXPECT(boundmethod, "str(_)", 1, File);
File *f = args[1].toFile();
if(!f->stream->isWritable()) {
return FileError::sete("File is not writable!");
}
BoundMethod *b = args[0].toBoundMethod();
switch(b->type) {
case BoundMethod::CLASS_BOUND:
f->writableStream()->fmt("",
b->binder.toClass()->name, b->func->name,
b->func->arity);
return ValueTrue;
default:
f->writableStream()->fmt("