Skip to content

Commit

Permalink
Revert "chore: unconcluent tests with SafeArrayIterator"
Browse files Browse the repository at this point in the history
This reverts commit 916d489.
  • Loading branch information
tpoisseau committed Aug 14, 2024
1 parent 916d489 commit 406165d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
10 changes: 2 additions & 8 deletions lib/sqlite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const {
SafeArrayIterator,
globalThis,
} = primordials;

Expand All @@ -9,13 +8,8 @@ const { emitExperimentalWarning } = require('internal/util');
emitExperimentalWarning('SQLite');
module.exports = internalBinding('sqlite');

const {Iterator} = globalThis;
const { Iterator } = globalThis;
const statementIterate = module.exports.StatementSync.prototype.iterate;
module.exports.StatementSync.prototype.iterate = function iterate() {
return new SafeArrayIterator(statementIterate.apply(this, arguments));
return statementIterate.apply(this, arguments);
return Iterator.from(
statementIterate.apply(this, arguments)
// new SafeArrayIterator(statementIterate.apply(this, arguments))
);
return Iterator.from(statementIterate.apply(this, arguments));
};
8 changes: 0 additions & 8 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,6 @@ struct IterateCaptureContext {
StatementSync* stmt;
};

void IteratorFunc(const v8::FunctionCallbackInfo<v8::Value>& info) {
info.GetReturnValue().Set(info.Holder());
}

void StatementSync::IterateReturnCallback(
const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
Expand Down Expand Up @@ -588,15 +584,11 @@ void StatementSync::Iterate(const FunctionCallbackInfo<Value>& args) {
v8::FunctionTemplate::New(isolate,
StatementSync::IterateReturnCallback,
External::New(isolate, captureContext));
v8::Local<v8::FunctionTemplate> iteratorFuncTemplate =
v8::FunctionTemplate::New(isolate, IteratorFunc);

iterableIteratorTemplate->Set(String::NewFromUtf8Literal(isolate, "next"),
nextFuncTemplate);
iterableIteratorTemplate->Set(String::NewFromUtf8Literal(isolate, "return"),
returnFuncTemplate);
iterableIteratorTemplate->Set(v8::Symbol::GetIterator(isolate),
iteratorFuncTemplate);

auto iterableIterator =
iterableIteratorTemplate->NewInstance(context).ToLocalChecked();
Expand Down

0 comments on commit 406165d

Please sign in to comment.