js: Fix app.transaction() method

Now we are calling the argument instead of the same transaction()
function recursively.
This commit is contained in:
David Capello 2018-08-20 14:42:28 -03:00
parent c902be8fdf
commit 1306f9a8a1
3 changed files with 14 additions and 7 deletions

View File

@ -63,7 +63,8 @@ void App_transaction(script::ContextHandle handle)
if (ctx.isCallable(1)) {
Tx tx; // Create a new transaction so it exists in the whole
// duration of the argument function call.
ctx.call(1);
ctx.copy(1);
ctx.call(0);
tx.commit();
}
else

View File

@ -45,11 +45,6 @@ void* Context::getContextUserData()
return js_getcontext(m_handle);
}
void Context::call(index_t i)
{
js_call(m_handle, i);
}
void Context::error(const char* err)
{
js_error(m_handle, "%s", err);
@ -80,6 +75,16 @@ index_t Context::top()
return js_gettop(m_handle);
}
void Context::copy(index_t i)
{
js_copy(m_handle, i);
}
void Context::call(index_t args)
{
js_call(m_handle, args);
}
bool Context::isUndefined(index_t i)
{
return (js_isundefined(m_handle, i) ? true: false);

View File

@ -55,7 +55,6 @@ namespace script {
void setContextUserData(void* userData);
void* getContextUserData();
void call(index_t i);
void error(const char* err);
void pop();
@ -63,6 +62,8 @@ namespace script {
void remove(index_t idx);
void duplicateTop();
index_t top();
void copy(index_t i);
void call(index_t args);
bool isUndefined(index_t i);
bool isNull(index_t i);