Skip to content

Commit bdfee17

Browse files
authored
Cast v8::Object::GetInternalField() return value to v8::Value (#956)
1 parent 4b2e498 commit bdfee17

File tree

1 file changed

+46
-40
lines changed

1 file changed

+46
-40
lines changed

nan_callbacks_12_inl.h

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ void FunctionCallbackWrapper(const v8::FunctionCallbackInfo<v8::Value> &info) {
170170
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
171171
FunctionCallback callback = reinterpret_cast<FunctionCallback>(
172172
reinterpret_cast<intptr_t>(
173-
obj->GetInternalField(kFunctionIndex).As<v8::External>()->Value()));
173+
obj->GetInternalField(kFunctionIndex)
174+
.As<v8::Value>().As<v8::External>()->Value()));
174175
FunctionCallbackInfo<v8::Value>
175-
cbinfo(info, obj->GetInternalField(kDataIndex));
176+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
176177
callback(cbinfo);
177178
}
178179

@@ -185,10 +186,11 @@ void GetterCallbackWrapper(
185186
, const v8::PropertyCallbackInfo<v8::Value> &info) {
186187
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
187188
PropertyCallbackInfo<v8::Value>
188-
cbinfo(info, obj->GetInternalField(kDataIndex));
189+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
189190
GetterCallback callback = reinterpret_cast<GetterCallback>(
190191
reinterpret_cast<intptr_t>(
191-
obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
192+
obj->GetInternalField(kGetterIndex)
193+
.As<v8::Value>().As<v8::External>()->Value()));
192194
callback(property.As<v8::String>(), cbinfo);
193195
}
194196

@@ -202,10 +204,11 @@ void SetterCallbackWrapper(
202204
, const v8::PropertyCallbackInfo<void> &info) {
203205
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
204206
PropertyCallbackInfo<void>
205-
cbinfo(info, obj->GetInternalField(kDataIndex));
207+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
206208
SetterCallback callback = reinterpret_cast<SetterCallback>(
207209
reinterpret_cast<intptr_t>(
208-
obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
210+
obj->GetInternalField(kSetterIndex)
211+
.As<v8::Value>().As<v8::External>()->Value()));
209212
callback(property.As<v8::String>(), value, cbinfo);
210213
}
211214

@@ -220,10 +223,11 @@ void GetterCallbackWrapper(
220223
, const v8::PropertyCallbackInfo<v8::Value> &info) {
221224
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
222225
PropertyCallbackInfo<v8::Value>
223-
cbinfo(info, obj->GetInternalField(kDataIndex));
226+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
224227
GetterCallback callback = reinterpret_cast<GetterCallback>(
225228
reinterpret_cast<intptr_t>(
226-
obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
229+
obj->GetInternalField(kGetterIndex)
230+
.As<v8::Value>().As<v8::External>()->Value()));
227231
callback(property, cbinfo);
228232
}
229233

@@ -237,10 +241,11 @@ void SetterCallbackWrapper(
237241
, const v8::PropertyCallbackInfo<void> &info) {
238242
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
239243
PropertyCallbackInfo<void>
240-
cbinfo(info, obj->GetInternalField(kDataIndex));
244+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
241245
SetterCallback callback = reinterpret_cast<SetterCallback>(
242246
reinterpret_cast<intptr_t>(
243-
obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
247+
obj->GetInternalField(kSetterIndex)
248+
.As<v8::Value>().As<v8::External>()->Value()));
244249
callback(property, value, cbinfo);
245250
}
246251

@@ -257,11 +262,11 @@ void PropertyGetterCallbackWrapper(
257262
, const v8::PropertyCallbackInfo<v8::Value> &info) {
258263
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
259264
PropertyCallbackInfo<v8::Value>
260-
cbinfo(info, obj->GetInternalField(kDataIndex));
265+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
261266
PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
262267
reinterpret_cast<intptr_t>(
263268
obj->GetInternalField(kPropertyGetterIndex)
264-
.As<v8::External>()->Value()));
269+
.As<v8::Value>().As<v8::External>()->Value()));
265270
callback(property.As<v8::String>(), cbinfo);
266271
}
267272

@@ -275,11 +280,11 @@ void PropertySetterCallbackWrapper(
275280
, const v8::PropertyCallbackInfo<v8::Value> &info) {
276281
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
277282
PropertyCallbackInfo<v8::Value>
278-
cbinfo(info, obj->GetInternalField(kDataIndex));
283+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
279284
PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
280285
reinterpret_cast<intptr_t>(
281286
obj->GetInternalField(kPropertySetterIndex)
282-
.As<v8::External>()->Value()));
287+
.As<v8::Value>().As<v8::External>()->Value()));
283288
callback(property.As<v8::String>(), value, cbinfo);
284289
}
285290

@@ -293,11 +298,11 @@ void PropertyEnumeratorCallbackWrapper(
293298
const v8::PropertyCallbackInfo<v8::Array> &info) {
294299
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
295300
PropertyCallbackInfo<v8::Array>
296-
cbinfo(info, obj->GetInternalField(kDataIndex));
301+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
297302
PropertyEnumeratorCallback callback =
298303
reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
299304
obj->GetInternalField(kPropertyEnumeratorIndex)
300-
.As<v8::External>()->Value()));
305+
.As<v8::Value>().As<v8::External>()->Value()));
301306
callback(cbinfo);
302307
}
303308

@@ -310,11 +315,11 @@ void PropertyDeleterCallbackWrapper(
310315
, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
311316
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
312317
PropertyCallbackInfo<v8::Boolean>
313-
cbinfo(info, obj->GetInternalField(kDataIndex));
318+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
314319
PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
315320
reinterpret_cast<intptr_t>(
316321
obj->GetInternalField(kPropertyDeleterIndex)
317-
.As<v8::External>()->Value()));
322+
.As<v8::Value>().As<v8::External>()->Value()));
318323
callback(property.As<v8::String>(), cbinfo);
319324
}
320325

@@ -327,11 +332,11 @@ void PropertyQueryCallbackWrapper(
327332
, const v8::PropertyCallbackInfo<v8::Integer> &info) {
328333
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
329334
PropertyCallbackInfo<v8::Integer>
330-
cbinfo(info, obj->GetInternalField(kDataIndex));
335+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
331336
PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
332337
reinterpret_cast<intptr_t>(
333338
obj->GetInternalField(kPropertyQueryIndex)
334-
.As<v8::External>()->Value()));
339+
.As<v8::Value>().As<v8::External>()->Value()));
335340
callback(property.As<v8::String>(), cbinfo);
336341
}
337342

@@ -344,11 +349,11 @@ void PropertyGetterCallbackWrapper(
344349
, const v8::PropertyCallbackInfo<v8::Value> &info) {
345350
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
346351
PropertyCallbackInfo<v8::Value>
347-
cbinfo(info, obj->GetInternalField(kDataIndex));
352+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
348353
PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
349354
reinterpret_cast<intptr_t>(
350355
obj->GetInternalField(kPropertyGetterIndex)
351-
.As<v8::External>()->Value()));
356+
.As<v8::Value>().As<v8::External>()->Value()));
352357
callback(property, cbinfo);
353358
}
354359

@@ -362,11 +367,11 @@ void PropertySetterCallbackWrapper(
362367
, const v8::PropertyCallbackInfo<v8::Value> &info) {
363368
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
364369
PropertyCallbackInfo<v8::Value>
365-
cbinfo(info, obj->GetInternalField(kDataIndex));
370+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
366371
PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
367372
reinterpret_cast<intptr_t>(
368373
obj->GetInternalField(kPropertySetterIndex)
369-
.As<v8::External>()->Value()));
374+
.As<v8::Value>().As<v8::External>()->Value()));
370375
callback(property, value, cbinfo);
371376
}
372377

@@ -380,11 +385,11 @@ void PropertyEnumeratorCallbackWrapper(
380385
const v8::PropertyCallbackInfo<v8::Array> &info) {
381386
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
382387
PropertyCallbackInfo<v8::Array>
383-
cbinfo(info, obj->GetInternalField(kDataIndex));
388+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
384389
PropertyEnumeratorCallback callback =
385390
reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
386391
obj->GetInternalField(kPropertyEnumeratorIndex)
387-
.As<v8::External>()->Value()));
392+
.As<v8::Value>().As<v8::External>()->Value()));
388393
callback(cbinfo);
389394
}
390395

@@ -397,11 +402,11 @@ void PropertyDeleterCallbackWrapper(
397402
, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
398403
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
399404
PropertyCallbackInfo<v8::Boolean>
400-
cbinfo(info, obj->GetInternalField(kDataIndex));
405+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
401406
PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
402407
reinterpret_cast<intptr_t>(
403408
obj->GetInternalField(kPropertyDeleterIndex)
404-
.As<v8::External>()->Value()));
409+
.As<v8::Value>().As<v8::External>()->Value()));
405410
callback(property, cbinfo);
406411
}
407412

@@ -414,11 +419,11 @@ void PropertyQueryCallbackWrapper(
414419
, const v8::PropertyCallbackInfo<v8::Integer> &info) {
415420
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
416421
PropertyCallbackInfo<v8::Integer>
417-
cbinfo(info, obj->GetInternalField(kDataIndex));
422+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
418423
PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
419424
reinterpret_cast<intptr_t>(
420425
obj->GetInternalField(kPropertyQueryIndex)
421-
.As<v8::External>()->Value()));
426+
.As<v8::Value>().As<v8::External>()->Value()));
422427
callback(property, cbinfo);
423428
}
424429

@@ -431,11 +436,11 @@ void IndexGetterCallbackWrapper(
431436
uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
432437
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
433438
PropertyCallbackInfo<v8::Value>
434-
cbinfo(info, obj->GetInternalField(kDataIndex));
439+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
435440
IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
436441
reinterpret_cast<intptr_t>(
437442
obj->GetInternalField(kIndexPropertyGetterIndex)
438-
.As<v8::External>()->Value()));
443+
.As<v8::Value>().As<v8::External>()->Value()));
439444
callback(index, cbinfo);
440445
}
441446

@@ -449,11 +454,11 @@ void IndexSetterCallbackWrapper(
449454
, const v8::PropertyCallbackInfo<v8::Value> &info) {
450455
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
451456
PropertyCallbackInfo<v8::Value>
452-
cbinfo(info, obj->GetInternalField(kDataIndex));
457+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
453458
IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
454459
reinterpret_cast<intptr_t>(
455460
obj->GetInternalField(kIndexPropertySetterIndex)
456-
.As<v8::External>()->Value()));
461+
.As<v8::Value>().As<v8::External>()->Value()));
457462
callback(index, value, cbinfo);
458463
}
459464

@@ -467,11 +472,12 @@ void IndexEnumeratorCallbackWrapper(
467472
const v8::PropertyCallbackInfo<v8::Array> &info) {
468473
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
469474
PropertyCallbackInfo<v8::Array>
470-
cbinfo(info, obj->GetInternalField(kDataIndex));
475+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
471476
IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
472477
reinterpret_cast<intptr_t>(
473478
obj->GetInternalField(
474-
kIndexPropertyEnumeratorIndex).As<v8::External>()->Value()));
479+
kIndexPropertyEnumeratorIndex)
480+
.As<v8::Value>().As<v8::External>()->Value()));
475481
callback(cbinfo);
476482
}
477483

@@ -483,11 +489,11 @@ void IndexDeleterCallbackWrapper(
483489
uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
484490
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
485491
PropertyCallbackInfo<v8::Boolean>
486-
cbinfo(info, obj->GetInternalField(kDataIndex));
492+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
487493
IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
488494
reinterpret_cast<intptr_t>(
489495
obj->GetInternalField(kIndexPropertyDeleterIndex)
490-
.As<v8::External>()->Value()));
496+
.As<v8::Value>().As<v8::External>()->Value()));
491497
callback(index, cbinfo);
492498
}
493499

@@ -499,11 +505,11 @@ void IndexQueryCallbackWrapper(
499505
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer> &info) {
500506
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
501507
PropertyCallbackInfo<v8::Integer>
502-
cbinfo(info, obj->GetInternalField(kDataIndex));
508+
cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
503509
IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
504510
reinterpret_cast<intptr_t>(
505511
obj->GetInternalField(kIndexPropertyQueryIndex)
506-
.As<v8::External>()->Value()));
512+
.As<v8::Value>().As<v8::External>()->Value()));
507513
callback(index, cbinfo);
508514
}
509515

0 commit comments

Comments
 (0)