Count-only scan used by the early gate (no storage).
| 217 | |
| 218 | // Count-only scan used by the early gate (no storage). |
| 219 | static bool has_export_macro_candidates(const char *source, int source_len) { |
| 220 | if (!source || source_len <= 0) { |
| 221 | return false; |
| 222 | } |
| 223 | int i = 0; |
| 224 | while (i < source_len) { |
| 225 | i = skip_non_code(source, source_len, i); |
| 226 | if (i >= source_len) { |
| 227 | break; |
| 228 | } |
| 229 | if (!is_identifier_start(source[i])) { |
| 230 | i++; |
| 231 | continue; |
| 232 | } |
| 233 | int start = i; |
| 234 | while (i < source_len && is_identifier_char(source[i])) { |
| 235 | i++; |
| 236 | } |
| 237 | // A raw-string prefix consumes everything up to its closing quote; |
| 238 | // an unrecognizable raw form poisons the scan state, so fail toward |
| 239 | // NOT running the second pass (raw behavior preserved). |
| 240 | int raw = raw_string_after_prefix(source, source_len, start, i); |
| 241 | if (raw < 0) { |
| 242 | return false; |
| 243 | } |
| 244 | if (raw > 0) { |
| 245 | i = raw; |
| 246 | continue; |
| 247 | } |
| 248 | if (is_export_macro_shape(source + start, (size_t)(i - start))) { |
| 249 | return true; |
| 250 | } |
| 251 | } |
| 252 | return false; |
| 253 | } |
| 254 | |
| 255 | static int collect_export_macro_candidates(const char *source, int source_len, |
| 256 | char (*out)[CBM_EXPORT_MACRO_NAME_MAX], int max_out) { |
no test coverage detected