瀏覽代碼

Disable generator export for V8 < 3.30 (not supported)

Stefan Siegl 9 年之前
父節點
當前提交
89399fa961
共有 4 個文件被更改,包括 11 次插入0 次删除
  1. 1 0
      php_v8js_macros.h
  2. 4 0
      v8js_generator_export.cc
  3. 4 0
      v8js_generator_export.h
  4. 2 0
      v8js_object_export.cc

+ 1 - 0
php_v8js_macros.h

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

+ 4 - 0
v8js_generator_export.cc

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

+ 4 - 0
v8js_generator_export.h

@@ -13,8 +13,12 @@
 #ifndef 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);
 
+#endif /* V8JS_GENERATOR_EXPORT_SUPPORT */
+
 #endif /* V8JS_GENERATOR_EXPORT_H */
 
 /*

+ 2 - 0
v8js_object_export.cc

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