0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 18:41:52 +00:00

Merge pull request #435 from timothympace/api_updates

Remove deprecated Context versions of ToBoolean and BooleanValue
This commit is contained in:
Stefan Siegl 2020-03-06 10:27:05 +01:00 committed by GitHub
commit 801c744885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 19 deletions

View File

@ -212,12 +212,8 @@ int v8js_to_zval(v8::Local<v8::Value> jsValue, zval *return_value, int flags, v8
} }
else if (jsValue->IsBoolean()) else if (jsValue->IsBoolean())
{ {
v8::Maybe<bool> value = jsValue->BooleanValue(v8_context); bool value = jsValue->BooleanValue(isolate);
if (value.IsNothing()) RETVAL_BOOL(value);
{
return FAILURE;
}
RETVAL_BOOL(value.ToChecked());
} }
else if (jsValue->IsInt32() || jsValue->IsUint32()) else if (jsValue->IsInt32() || jsValue->IsUint32())
{ {

View File

@ -122,15 +122,8 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local<v8::Value> var, int leve
} }
if (var->IsBoolean()) if (var->IsBoolean())
{ {
v8::Maybe<bool> value = var->BooleanValue(v8_context); bool value = var->BooleanValue(isolate);
if (value.IsNothing()) php_printf("bool(%s)\n", value ? "true" : "false");
{
php_printf("<empty>\n");
}
else
{
php_printf("bool(%s)\n", value.FromJust() ? "true" : "false");
}
return; return;
} }

View File

@ -863,9 +863,9 @@ static void v8js_named_property_deleter(v8::Local<v8::Name> property, const v8::
} }
v8::Isolate *isolate = info.GetIsolate(); v8::Isolate *isolate = info.GetIsolate();
v8::MaybeLocal<v8::Boolean> value = r->ToBoolean(isolate->GetEnteredContext()); v8::Local<v8::Boolean> value = r->ToBoolean(isolate);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
info.GetReturnValue().Set(value.ToLocalChecked()); info.GetReturnValue().Set(value);
} }
} }
/* }}} */ /* }}} */

View File

@ -133,7 +133,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value,
c->tz = strdup(tz); c->tz = strdup(tz);
} }
else if (strcmp(c->tz, tz) != 0) { else if (strcmp(c->tz, tz) != 0) {
v8::Date::DateTimeConfigurationChangeNotification(c->isolate); c->isolate->DateTimeConfigurationChangeNotification();
free(c->tz); free(c->tz);
c->tz = strdup(tz); c->tz = strdup(tz);

View File

@ -98,7 +98,7 @@ static int v8js_v8object_has_property(zval *object, zval *member, int has_set_ex
} }
/* empty() */ /* empty() */
retval = jsVal->BooleanValue(v8_context).FromMaybe(false); retval = jsVal->BooleanValue(isolate);
/* for PHP compatibility, [] should also be empty */ /* for PHP compatibility, [] should also be empty */
if (jsVal->IsArray() && retval) { if (jsVal->IsArray() && retval) {