From fea0b6986577b9b8834540ceffec76e5ecca1c50 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Mon, 18 Apr 2016 15:58:41 -0700 Subject: [PATCH] add support for non-memmber functions --- src/js_realm.hpp | 2 +- src/js_types.hpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js_realm.hpp b/src/js_realm.hpp index 5ed46f75..08fba18c 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -295,7 +295,7 @@ void Realm::constructor(ContextType ctx, ObjectType this_object, size_t argc, create_object>(ctx, new SharedRealm(old_realm)), create_object>(ctx, new SharedRealm(realm)) }; - Function::call(ctx, migration_function, nullptr, 2, arguments); + Function::call(ctx, migration_function, 2, arguments); }; } diff --git a/src/js_types.hpp b/src/js_types.hpp index 0f2af00e..3a3f967d 100644 --- a/src/js_types.hpp +++ b/src/js_types.hpp @@ -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 &arguments) { return call(ctx, function, this_object, arguments.size(), arguments.data()); }