diff options
author | stephan <stephan@noemail.net> | 2022-12-25 17:09:34 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-12-25 17:09:34 +0000 |
commit | 73bf9d5fed1ed13e4bfdd4c338115e3dd4e95c6b (patch) | |
tree | 69a45b7e9c044e1cf06052fac4843995c7634f31 /ext/wasm/common/whwasmutil.js | |
parent | 7015aa9f4957c3131c8bc814c81c4c5d2dea8f89 (diff) | |
download | sqlite-73bf9d5fed1ed13e4bfdd4c338115e3dd4e95c6b.tar.gz sqlite-73bf9d5fed1ed13e4bfdd4c338115e3dd4e95c6b.zip |
Replace the "manual" implementation of sqlite3.capi.sqlite3_exec() with a briefer "automated" one via the [7f9ace1b11a67] feature addition. Minor code-adjacent internal cleanups.
FossilOrigin-Name: 4888957baf18c6763f959fbba998a74156ff656368779107f502b926e9e9d949
Diffstat (limited to 'ext/wasm/common/whwasmutil.js')
-rw-r--r-- | ext/wasm/common/whwasmutil.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ext/wasm/common/whwasmutil.js b/ext/wasm/common/whwasmutil.js index 8e1858612..7a7747ef3 100644 --- a/ext/wasm/common/whwasmutil.js +++ b/ext/wasm/common/whwasmutil.js @@ -1604,18 +1604,19 @@ self.WhWasmUtilInstaller = function(target){ 'client-level code. Invoked with:',opt); } this.signature = opt.signature; - if(!opt.bindScope && (opt.contextKey instanceof Function)){ - opt.bindScope = 'context'; - }else if(FuncPtrAdapter.bindScopes.indexOf(opt.bindScope)<0){ + if(opt.contextKey instanceof Function){ + this.contextKey = opt.contextKey; + if(!opt.bindScope) opt.bindScope = 'context'; + } + this.bindScope = opt.bindScope + || toss("FuncPtrAdapter options requires a bindScope (explicit or implied)."); + if(FuncPtrAdapter.bindScopes.indexOf(opt.bindScope)<0){ toss("Invalid options.bindScope ("+opt.bindMod+") for FuncPtrAdapter. "+ "Expecting one of: ("+FuncPtrAdapter.bindScopes.join(', ')+')'); } - this.bindScope = opt.bindScope; - if(opt.contextKey) this.contextKey = opt.contextKey /*else inherit one*/; this.isTransient = 'transient'===this.bindScope; this.isContext = 'context'===this.bindScope; - if( ('singleton'===this.bindScope) ) this.singleton = []; - else this.singleton = undefined; + this.singleton = ('singleton'===this.bindScope) ? [] : undefined; //console.warn("FuncPtrAdapter()",opt,this); this.callProxy = (opt.callProxy instanceof Function) ? opt.callProxy : undefined; @@ -1918,7 +1919,7 @@ self.WhWasmUtilInstaller = function(target){ const scope = target.scopedAllocPush(); try{ /* - Maintenance reminder re. arguments passed to convertArgs(): + Maintenance reminder re. arguments passed to convertArg(): The public interface of argument adapters is that they take ONE argument and return a (possibly) converted result for it. The passing-on of arguments after the first is an |