diff options
author | Olly Betts <olly@survex.com> | 2023-01-05 16:54:16 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2023-05-11 13:11:22 +1200 |
commit | 9c8d6563498bbfd22d05b225930409236834b867 (patch) | |
tree | 197887f358073c65a911882674c874ee4e17cd9a /Source/Modules/php.cxx | |
parent | 38f8f15fcd4747cb1db136de74874dd779a75c6f (diff) | |
download | swig-parse-storage-class-flexibly.tar.gz |
Parse storage class more flexiblyparse-storage-class-flexibly
Previously we had a hard-coded list of allowed combinations in the
grammar, but this suffers from combinatorial explosion, and results
in a vague `Syntax error in input` error for invalid combinations.
This means we now support a number of cases which are valid C++
but weren't supported.
Fixes #302
Fixes #2079 (friend constexpr)
Fixes #2474 (virtual explicit)
Diffstat (limited to 'Source/Modules/php.cxx')
-rw-r--r-- | Source/Modules/php.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 8e16c6969..67c73aa6b 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -951,7 +951,7 @@ public: void create_command(String *cname, String *fname, Node *n, bool dispatch, String *modes) { // This is for the single main zend_function_entry record ParmList *l = Getattr(n, "parms"); - if (cname && !Equal(Getattr(n, "storage"), "friend")) { + if (cname && !Strstr(Getattr(n, "storage"), "friend")) { Printf(f_h, "static PHP_METHOD(%s%s,%s);\n", prefix, cname, fname); if (wrapperType != staticmemberfn && wrapperType != staticmembervar && @@ -973,7 +973,7 @@ public: String *arginfo_id = phptypes->get_arginfo_id(); String *s = cs_entry; if (!s) s = s_entry; - if (cname && !Equal(Getattr(n, "storage"), "friend")) { + if (cname && !Strstr(Getattr(n, "storage"), "friend")) { Printf(all_cs_entry, " PHP_ME(%s%s,%s,swig_arginfo_%s,%s)\n", prefix, cname, fname, arginfo_id, modes); } else { if (dispatch) { @@ -1043,7 +1043,7 @@ public: create_command(class_name, wname, n, true, modes); - if (class_name && !Equal(Getattr(n, "storage"), "friend")) { + if (class_name && !Strstr(Getattr(n, "storage"), "friend")) { Printv(f->def, "static PHP_METHOD(", prefix, class_name, ",", wname, ") {\n", NIL); } else { Printv(f->def, "static ZEND_NAMED_FUNCTION(", wname, ") {\n", NIL); @@ -1340,7 +1340,7 @@ public: wname = Getattr(n, "staticmemberfunctionHandler:sym:name"); } else { if (class_name) { - if (Cmp(Getattr(n, "storage"), "friend") == 0 && Cmp(Getattr(n, "view"), "globalfunctionHandler") == 0) { + if (Strstr(Getattr(n, "storage"), "friend") && Cmp(Getattr(n, "view"), "globalfunctionHandler") == 0) { wname = iname; } else { wname = Getattr(n, "destructorHandler:sym:name"); @@ -1364,7 +1364,7 @@ public: phptypes = NULL; String *key; - if (class_name && !Equal(Getattr(n, "storage"), "friend")) { + if (class_name && !Strstr(Getattr(n, "storage"), "friend")) { key = NewStringf("%s:%s", class_name, wname); } else { key = NewStringf(":%s", wname); @@ -1395,7 +1395,7 @@ public: if (!overloaded) { if (!static_getter) { - if (class_name && !Equal(Getattr(n, "storage"), "friend")) { + if (class_name && !Strstr(Getattr(n, "storage"), "friend")) { Printv(f->def, "static PHP_METHOD(", prefix, class_name, ",", wname, ") {\n", NIL); } else { if (wrap_nonclass_global) { @@ -1589,7 +1589,7 @@ public: List *return_types = phptypes->process_phptype(n, 0, "tmap:out:phptype"); - if (class_name && !Equal(Getattr(n, "storage"), "friend")) { + if (class_name && !Strstr(Getattr(n, "storage"), "friend")) { if (is_member_director(n)) { String *parent = class_name; while ((parent = Getattr(php_parent_class, parent)) != NULL) { |