Add convenience variable_ensure_slot
This commit is contained in:
parent
52d9210400
commit
cfc8bb89f8
2 changed files with 12 additions and 0 deletions
|
@ -83,6 +83,8 @@ namespace wren {
|
||||||
template <typename T> T* foreign (VM& vm, int slot_num);
|
template <typename T> T* foreign (VM& vm, int slot_num);
|
||||||
void variable(VM& vm, const ModuleAndName& mod_and_name, int slot);
|
void variable(VM& vm, const ModuleAndName& mod_and_name, int slot);
|
||||||
void variable(VM& vm, const Handle& handle, int slot);
|
void variable(VM& vm, const Handle& handle, int slot);
|
||||||
|
void variable_ensure_slot(VM& vm, const ModuleAndName& mod_and_name, int slot);
|
||||||
|
void variable_ensure_slot(VM& vm, const Handle& handle, int slot);
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename T> struct TType { typedef T type; };
|
template <typename T> struct TType { typedef T type; };
|
||||||
|
|
|
@ -79,4 +79,14 @@ namespace wren {
|
||||||
void variable (VM& vm, const Handle& handle, int slot) {
|
void variable (VM& vm, const Handle& handle, int slot) {
|
||||||
vm.set_slot_handle(handle, slot);
|
vm.set_slot_handle(handle, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void variable_ensure_slot(VM& vm, const ModuleAndName& mod_and_name, int slot) {
|
||||||
|
vm.ensure_slots(1);
|
||||||
|
variable(vm, mod_and_name, slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
void variable_ensure_slot (VM& vm, const Handle& handle, int slot) {
|
||||||
|
vm.ensure_slots(1);
|
||||||
|
variable(vm, handle, slot);
|
||||||
|
}
|
||||||
} //namespace wren
|
} //namespace wren
|
||||||
|
|
Loading…
Reference in a new issue