0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 19:51:51 +00:00

Disable generator export for V8 < 3.30 (not supported)

This commit is contained in:
Stefan Siegl 2016-01-09 14:17:48 +01:00
parent 80575beecc
commit 89399fa961
4 changed files with 11 additions and 0 deletions

View File

@ -63,6 +63,7 @@ extern "C" {
#if PHP_V8_API_VERSION >= 3030000 #if PHP_V8_API_VERSION >= 3030000
#define V8JS_V8GENERATOR_SUPPORT 1 #define V8JS_V8GENERATOR_SUPPORT 1
#define V8JS_GENERATOR_EXPORT_SUPPORT 1
#endif #endif
/* method signatures of zend_update_property and zend_read_property were /* method signatures of zend_update_property and zend_read_property were

View File

@ -17,6 +17,8 @@
#include <assert.h> #include <assert.h>
#include "php_v8js_macros.h" #include "php_v8js_macros.h"
#ifdef V8JS_GENERATOR_EXPORT_SUPPORT
v8::Local<v8::Value> v8js_wrap_generator(v8::Isolate *isolate, 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; v8::Local<v8::Value> result;
@ -62,6 +64,8 @@ function(wrapped_object) { \
} }
/* }}} */ /* }}} */
#endif /* V8JS_GENERATOR_EXPORT_SUPPORT */
/* /*
* Local variables: * Local variables:
* tab-width: 4 * tab-width: 4

View File

@ -13,8 +13,12 @@
#ifndef V8JS_GENERATOR_EXPORT_H #ifndef V8JS_GENERATOR_EXPORT_H
#define V8JS_GENERATOR_EXPORT_H #define V8JS_GENERATOR_EXPORT_H
#ifdef V8JS_GENERATOR_EXPORT_SUPPORT
v8::Local<v8::Value> v8js_wrap_generator(v8::Isolate *isolate, 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_SUPPORT */
#endif /* V8JS_GENERATOR_EXPORT_H */ #endif /* V8JS_GENERATOR_EXPORT_H */
/* /*

View File

@ -959,11 +959,13 @@ v8::Handle<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRML
if (ce) { if (ce) {
v8::Local<v8::Value> wrapped_object = v8js_wrap_object(isolate, ce, value TSRMLS_CC); v8::Local<v8::Value> wrapped_object = v8js_wrap_object(isolate, ce, value TSRMLS_CC);
#ifdef V8JS_GENERATOR_EXPORT_SUPPORT
if (ce == zend_ce_generator) { if (ce == zend_ce_generator) {
/* Wrap PHP Generator object in a wrapper function that provides /* Wrap PHP Generator object in a wrapper function that provides
* ES6 style behaviour. */ * ES6 style behaviour. */
wrapped_object = v8js_wrap_generator(isolate, wrapped_object); wrapped_object = v8js_wrap_generator(isolate, wrapped_object);
} }
#endif
return wrapped_object; return wrapped_object;
} }