@@ -467,10 +467,6 @@ void StatementSync::All(const FunctionCallbackInfo<Value>& args) {
467467 Array::New (env->isolate (), rows.data (), rows.size ()));
468468}
469469
470- void IteratorFunc (const v8::FunctionCallbackInfo<v8::Value>& info) {
471- info.GetReturnValue ().Set (info.Holder ());
472- }
473-
474470struct IterateCaptureContext {
475471 int num_cols;
476472 StatementSync* stmt;
@@ -543,13 +539,11 @@ void StatementSync::Iterate(const FunctionCallbackInfo<Value>& args) {
543539 v8::External::New (isolate, captureContext)
544540 );
545541
546- v8::Local<v8::FunctionTemplate> iteratorFuncTemplate = v8::FunctionTemplate::New (isolate, IteratorFunc);
547542 iterableIteratorTemplate->Set (String::NewFromUtf8Literal (isolate, " next" ), nextFuncTemplate);
548- iterableIteratorTemplate->Set (v8::Symbol::GetIterator (isolate), iteratorFuncTemplate);
549543
550- v8::Local<v8::Value> iteratorPrototype = context-> Global ()-> Get ( context, String::NewFromUtf8Literal (isolate, " Iterator.prototype " ) ).ToLocalChecked ();
551- v8::Local<v8::Object> iterableIterator = iterableIteratorTemplate-> NewInstance ( context).ToLocalChecked ();
552- iterableIterator->SetPrototype (context, iteratorPrototype). ToChecked ();
544+ auto iterableIterator = iterableIteratorTemplate-> NewInstance ( context).ToLocalChecked ();
545+ auto JSIteratorPrototype = context-> Global ()-> Get ( context, String::NewFromUtf8Literal (isolate, " Iterator.prototype " ) ).ToLocalChecked ();
546+ iterableIterator->SetPrototype (context, JSIteratorPrototype). Check ();
553547
554548 args.GetReturnValue ().Set (iterableIterator);
555549}
0 commit comments