| 2622 | } |
| 2623 | |
| 2624 | static php_use_shape_t php_use_shape(const char *source_rel, const CBMImport *imp) { |
| 2625 | if (!source_rel || cbm_language_for_filename(path_leaf(source_rel)) != CBM_LANG_PHP) { |
| 2626 | return PHP_USE_NONE; |
| 2627 | } |
| 2628 | const char *p = imp->module_path; |
| 2629 | if (p[0] == '\\') { |
| 2630 | p++; |
| 2631 | } |
| 2632 | if (!p[0]) { |
| 2633 | return PHP_USE_NONE; |
| 2634 | } |
| 2635 | bool qualified = false; |
| 2636 | for (; *p; p++) { |
| 2637 | unsigned char c = (unsigned char)*p; |
| 2638 | if (c == '\\') { |
| 2639 | qualified = true; |
| 2640 | } else if (!php_ident_byte(c)) { |
| 2641 | return PHP_USE_NONE; |
| 2642 | } |
| 2643 | } |
| 2644 | return qualified ? PHP_USE_NAMESPACED : PHP_USE_GLOBAL; |
| 2645 | } |
| 2646 | |
| 2647 | /* The next usable file of a namespace-map bucket (a '\n'-delimited list of |
| 2648 | * __file__ QNs): a PHP File node that is not the importing file. Advances |
no test coverage detected