add support for non-memmber functions

This commit is contained in:
Ari Lazier 2016-04-18 15:58:41 -07:00
parent 17e5946af4
commit fea0b69865
2 changed files with 4 additions and 1 deletions

View File

@ -295,7 +295,7 @@ void Realm<T>::constructor(ContextType ctx, ObjectType this_object, size_t argc,
create_object<T, RealmClass<T>>(ctx, new SharedRealm(old_realm)),
create_object<T, RealmClass<T>>(ctx, new SharedRealm(realm))
};
Function<T>::call(ctx, migration_function, nullptr, 2, arguments);
Function<T>::call(ctx, migration_function, 2, arguments);
};
}

View File

@ -129,6 +129,9 @@ struct Function {
using ValueType = typename T::Value;
static ValueType call(ContextType, const FunctionType &, const ObjectType &, size_t, const ValueType[]);
static ValueType call(ContextType ctx, const FunctionType &function, size_t argument_count, const ValueType arguments[]) {
return call(ctx, function, {}, argument_count, arguments);
}
static ValueType call(ContextType ctx, const FunctionType &function, const ObjectType &this_object, const std::vector<ValueType> &arguments) {
return call(ctx, function, this_object, arguments.size(), arguments.data());
}