diff options
author | Nishant Gupta <nish.gupta01@gmail.com> | 2016-08-02 11:36:39 +0530 |
---|---|---|
committer | Nishant Gupta <nish.gupta01@gmail.com> | 2016-08-02 11:36:39 +0530 |
commit | e0298b69aba302026b65758f094daa118f1b0ab7 (patch) | |
tree | f7e2b9bfb0582881d16cd7db521a34364d39acb3 | |
parent | 4fbfbcf4fbe3df388fa706a57ae222cce6e34fc7 (diff) | |
download | swig-e0298b69aba302026b65758f094daa118f1b0ab7.tar.gz |
Add PROP_CONST
-rw-r--r-- | Lib/hhvm/hhvm.swg | 29 | ||||
-rw-r--r-- | Lib/hhvm/hhvmrun.swg | 6 | ||||
-rw-r--r-- | Source/Modules/hhvm.cxx | 2 |
3 files changed, 7 insertions, 30 deletions
diff --git a/Lib/hhvm/hhvm.swg b/Lib/hhvm/hhvm.swg index 5e5b72b91..80d7f93ba 100644 --- a/Lib/hhvm/hhvm.swg +++ b/Lib/hhvm/hhvm.swg @@ -212,35 +212,6 @@ wrap_$1->_obj_ptr = new $1_ltype((const $1_ltype &) $1); %} -/* Ref for basic types */ -%define as_ref(TYPE) -%typemap(in) TYPE &, - TYPE && -%{ - $*1_ltype ref$1 = ($*1_ltype)$input; - $1 = &ref$1; -%} - -%typemap(out) TYPE &, - TYPE && -%{$result = ($1_ltype)$1;%} - -%typemap(argout) TYPE &, - TYPE && -%{$result.assignIfRef(*$1);%} -%enddef -as_ref(short); -as_ref(unsigned short); -as_ref(int); -as_ref(unsigned int); -as_ref(long); -as_ref(unsigned long); -as_ref(long long); -as_ref(unsigned long long); -as_ref(float); -as_ref(double); -as_ref(enum SWIGTYPE) - /* php types */ %typemap(php_type) int, diff --git a/Lib/hhvm/hhvmrun.swg b/Lib/hhvm/hhvmrun.swg index a3c7f6a26..7d08910df 100644 --- a/Lib/hhvm/hhvmrun.swg +++ b/Lib/hhvm/hhvmrun.swg @@ -7,6 +7,12 @@ return s_class; \ } +#if (HHVM_VERSION_MAJOR > 3 || (HHVM_VERSION_MAJOR == 3 && HHVM_VERSION_MINOR >= 13)) + #define HHVM_PROP_CONST const +#else + #define HHVM_PROP_CONST +#endif + namespace HPHP { namespace { diff --git a/Source/Modules/hhvm.cxx b/Source/Modules/hhvm.cxx index eb2c659b9..fa8e24562 100644 --- a/Source/Modules/hhvm.cxx +++ b/Source/Modules/hhvm.cxx @@ -956,7 +956,7 @@ public: if ((wname = Getattr(class_set_vars, varname))) { String *accname = NewStringf("SWIG_set_%s_%s", classname, varname); - Printf(f_link, "static void %s(const Object& this_, const Variant& value) {\n", accname); + Printf(f_link, "static void %s(const Object& this_, HHVM_PROP_CONST Variant& value) {\n", accname); Printf(f_link, " auto data = Object(this_);\n", wclassname); if ((tm = Swig_typemap_lookup("variant_out", n, varname, 0))) { Printf(f_link, " %s(data, value.%s());\n", wname, tm); |