0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-09 16:28:41 +00:00

Don't create v8::HandleScope in v8js_wrap_generator

This commit is contained in:
Stefan Siegl 2016-01-09 14:05:19 +01:00
parent dbe29d7e96
commit 80575beecc
3 changed files with 4 additions and 6 deletions

View File

@ -17,16 +17,15 @@
#include <assert.h>
#include "php_v8js_macros.h"
v8::Local<v8::Value> v8js_wrap_generator(v8js_ctx *ctx, v8::Local<v8::Value> wrapped_object) /* {{{ */
v8::Local<v8::Value> v8js_wrap_generator(v8::Isolate *isolate, v8::Local<v8::Value> wrapped_object) /* {{{ */
{
v8::Local<v8::Value> result;
V8JS_CTX_PROLOGUE_EX(ctx, result);
assert(!wrapped_object.IsEmpty());
assert(wrapped_object->IsObject());
v8::TryCatch try_catch;
v8::Local<v8::String> source = v8::String::NewFromUtf8(ctx->isolate, "(\
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, "(\
function(wrapped_object) { \
return (function*() { \
for(;;) { \

View File

@ -13,7 +13,7 @@
#ifndef V8JS_GENERATOR_EXPORT_H
#define V8JS_GENERATOR_EXPORT_H
v8::Local<v8::Value> v8js_wrap_generator(v8js_ctx *ctx, v8::Local<v8::Value> wrapped_object);
v8::Local<v8::Value> v8js_wrap_generator(v8::Isolate *isolate, v8::Local<v8::Value> wrapped_object);
#endif /* V8JS_GENERATOR_EXPORT_H */

View File

@ -962,8 +962,7 @@ v8::Handle<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRML
if (ce == zend_ce_generator) {
/* Wrap PHP Generator object in a wrapper function that provides
* ES6 style behaviour. */
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
wrapped_object = v8js_wrap_generator(ctx, wrapped_object);
wrapped_object = v8js_wrap_generator(isolate, wrapped_object);
}
return wrapped_object;