0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-26 16:09:37 -05:00

SnapshotCreator::GetIsolate() should have been a const method (#432)

This commit is contained in:
Bert Belder 2020-08-06 13:37:18 +02:00
parent 954163ab07
commit d84be8ca2a
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
2 changed files with 8 additions and 3 deletions

View file

@ -1430,8 +1430,11 @@ void v8__SnapshotCreator__DESTRUCT(v8::SnapshotCreator* self) {
void v8__StartupData__DESTRUCT(v8::StartupData* self) { delete[] self->data; } void v8__StartupData__DESTRUCT(v8::StartupData* self) { delete[] self->data; }
v8::Isolate* v8__SnapshotCreator__GetIsolate(v8::SnapshotCreator* self) { v8::Isolate* v8__SnapshotCreator__GetIsolate(const v8::SnapshotCreator& self) {
return self->GetIsolate(); // `v8::SnapshotCreator::GetIsolate()` is not declared as a const method, but
// this appears to be a mistake.
auto self_ptr = const_cast<v8::SnapshotCreator*>(&self);
return self_ptr->GetIsolate();
} }
v8::StartupData SerializeInternalFields(v8::Local<v8::Object> holder, int index, v8::StartupData SerializeInternalFields(v8::Local<v8::Object> holder, int index,

View file

@ -20,7 +20,7 @@ extern "C" {
); );
fn v8__SnapshotCreator__DESTRUCT(this: *mut SnapshotCreator); fn v8__SnapshotCreator__DESTRUCT(this: *mut SnapshotCreator);
fn v8__SnapshotCreator__GetIsolate( fn v8__SnapshotCreator__GetIsolate(
this: *mut SnapshotCreator, this: *const SnapshotCreator,
) -> *mut Isolate; ) -> *mut Isolate;
fn v8__SnapshotCreator__CreateBlob( fn v8__SnapshotCreator__CreateBlob(
this: *mut SnapshotCreator, this: *mut SnapshotCreator,
@ -33,6 +33,8 @@ extern "C" {
fn v8__StartupData__DESTRUCT(this: *mut StartupData); fn v8__StartupData__DESTRUCT(this: *mut StartupData);
} }
// TODO(piscisaureus): merge this struct with
// `isolate_create_params::raw::StartupData`.
#[repr(C)] #[repr(C)]
pub struct StartupData { pub struct StartupData {
data: *const char, data: *const char,