From a8cef95cb9020305b62fa97664d84dca4389d993 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 15 May 2022 16:19:42 +0200 Subject: [PATCH] Rename function I think this is the opposite of the code I'm working on now, ie it's not called by wren to create a c++ object but from c++ to create a wren object. I'll add an example for this. --- include/wrenpp/vm_fun.hpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/include/wrenpp/vm_fun.hpp b/include/wrenpp/vm_fun.hpp index fe0cd3b..1141b1b 100644 --- a/include/wrenpp/vm_fun.hpp +++ b/include/wrenpp/vm_fun.hpp @@ -32,9 +32,6 @@ #include namespace wren { - namespace detail { - } //namespace detail - template R call (VM& vm, const Handle& object, const Handle& method, const Args&... args); @@ -48,11 +45,11 @@ namespace wren { R call (VM& vm, const ModuleAndName& object, const char (&method)[N], const Args&... args); template - T* make_foreign_object(VM& vm, const ModuleAndName& mn, Args&&... args); + T* make_wren_object(VM& vm, const ModuleAndName& mn, Args&&... args); #if defined(WRENPP_WITH_NAME_GUESSING) template - T* make_foreign_object(VM& vm, const char* module, Args&&... args); + T* make_wren_object(VM& vm, const char* module, Args&&... args); #endif template @@ -172,7 +169,7 @@ namespace wren { } template - inline T* make_foreign_object(VM& vm, const ModuleAndName& mn, Args&&... args) { + inline T* make_wren_object(VM& vm, const ModuleAndName& mn, Args&&... args) { variable(vm, mn, 0); void* const mem = vm.set_slot_new_foreign(0, 0, sizeof(T)); T* const obj = new(mem) T{std::forward(args)...}; @@ -181,8 +178,8 @@ namespace wren { #if defined(WRENPP_WITH_NAME_GUESSING) template - inline T* make_foreign_object(VM& vm, const char* module, Args&&... args) { - return make_foreign_object( + inline T* make_wren_object(VM& vm, const char* module, Args&&... args) { + return make_wren_object( vm, ModuleAndName{module, guess_class_name()}, std::forward(args)...