Commit 29bf764d
29bf764d2310Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 1 file · ~1 modified
Description
Skip extend/include/def_delegators in expr context, handle interp regexp
- extend, include, private, protected, public, def_delegators now skipped in both stmt and expr contexts
- PM_INTERPOLATED_REGULAR_EXPRESSION_NODE returns NULL placeholder
- lrama template methods use self instead of output parameter, eliminating 337 String#Forwardable warnings
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 29bf764d2310
- Parent
- 141feafb3b41
src/expr.cmodifiedView file
@@ -266,6 +266,16 @@
266266
267267
char *method = cstr(ctx, call->name);268268
269+
/* Skip visibility/mixin directives in expression context */270+
if (!call->receiver && (strcmp(method, "private") == 0 ||271+
strcmp(method, "protected") == 0 || strcmp(method, "public") == 0 ||272+
strcmp(method, "extend") == 0 || strcmp(method, "include") == 0 ||273+
strcmp(method, "def_delegators") == 0 ||274+
strcmp(method, "frozen_string_literal") == 0)) {275+
free(method);276+
return xstrdup("0");277+
}278+
269279
/* N.times.map { |i| expr } → build IntArray from 0..N-1 */270280
if (strcmp(method, "map") == 0 && call->receiver &&271281
PM_NODE_TYPE(call->receiver) == PM_CALL_NODE && call->block &&