@@ -134,9 +134,15 @@ class Spellchecker : public Nan::ObjectWrap {
134
134
uint32_t start = iter->start , end = iter->end ;
135
135
136
136
Local<Object> misspelled_range = Nan::New<Object>();
137
- misspelled_range->Set (Nan::New (" start" ).ToLocalChecked (), Nan::New<Integer>(start));
138
- misspelled_range->Set (Nan::New (" end" ).ToLocalChecked (), Nan::New<Integer>(end));
139
- result->Set (index , misspelled_range);
137
+ {
138
+ Isolate* isolate = misspelled_range->GetIsolate ();
139
+ Local<Context> context = isolate->GetCurrentContext ();
140
+ misspelled_range->Set (context, Nan::New (" start" ).ToLocalChecked (), Nan::New<Integer>(start)).Check ();
141
+ misspelled_range->Set (context, Nan::New (" end" ).ToLocalChecked (), Nan::New<Integer>(end)).Check ();
142
+ }
143
+ Isolate* isolate = result->GetIsolate ();
144
+ Local<Context> context = isolate->GetCurrentContext ();
145
+ result->Set (context, index , misspelled_range).Check ();
140
146
}
141
147
}
142
148
@@ -220,7 +226,9 @@ class Spellchecker : public Nan::ObjectWrap {
220
226
Local<Array> result = Nan::New<Array>(dictionaries.size ());
221
227
for (size_t i = 0 ; i < dictionaries.size (); ++i) {
222
228
const std::string& dict = dictionaries[i];
223
- result->Set (i, Nan::New (dict.data (), dict.size ()).ToLocalChecked ());
229
+ Isolate* isolate = result->GetIsolate ();
230
+ Local<Context> context = isolate->GetCurrentContext ();
231
+ result->Set (context, i, Nan::New (dict.data (), dict.size ()).ToLocalChecked ()).Check ();
224
232
}
225
233
226
234
info.GetReturnValue ().Set (result);
@@ -246,7 +254,9 @@ class Spellchecker : public Nan::ObjectWrap {
246
254
const std::string& word = corrections[i];
247
255
248
256
Nan::MaybeLocal<String> val = Nan::New<String>(word.data (), word.size ());
249
- result->Set (i, val.ToLocalChecked ());
257
+ Isolate* isolate = result->GetIsolate ();
258
+ Local<Context> context = isolate->GetCurrentContext ();
259
+ result->Set (context, i, val.ToLocalChecked ()).Check ();
250
260
}
251
261
252
262
info.GetReturnValue ().Set (result);
@@ -286,7 +296,7 @@ class Spellchecker : public Nan::ObjectWrap {
286
296
287
297
Isolate* isolate = exports->GetIsolate ();
288
298
Local<Context> context = isolate->GetCurrentContext ();
289
- exports->Set (Nan::New (" Spellchecker" ).ToLocalChecked (), tpl->GetFunction (context).ToLocalChecked ());
299
+ exports->Set (context, Nan::New (" Spellchecker" ).ToLocalChecked (), tpl->GetFunction (context).ToLocalChecked ()). Check ( );
290
300
}
291
301
};
292
302
0 commit comments