Commit ed9cbf2d
ed9cbf2de750Merged
Ori Pekelman <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): expand container-method whitelist with universal operators
Per PR #269 review (gemini-code-assist): a param using only +, -,
*, /, <, ===, class, etc. is no more "user-classy" than one
using just length — the operator is on built-in Numeric / String /
Array too. Add the universal operators and Object methods to the
whitelist so they're treated the same as length / [] / each.
Refs #266
Details
- Commit
- ed9cbf2de750
- Parent
- d7618c3f5e89
spinel_codegen.rbmodifiedView file
@@ -9482,9 +9482,18 @@
94829482
m != "sum" && m != "min" && m != "max" && m != "minmax" &&94839483
m != "concat" && m != "flatten" && m != "uniq" && m != "compact" &&94849484
m != "slice" && m != "fetch" && m != "dig" &&9485+
# Universal Object methods94859486
m != "freeze" && m != "frozen?" && m != "dup" && m != "clone" &&9486-
m != "hash" && m != "==" && m != "!=" && m != "eql?" && m != "equal?" &&9487-
m != "nil?" && m != "is_a?" && m != "kind_of?" && m != "respond_to?"9487+
m != "hash" && m != "class" && m != "tap" &&9488+
m != "==" && m != "!=" && m != "eql?" && m != "equal?" &&9489+
m != "nil?" && m != "is_a?" && m != "kind_of?" && m != "respond_to?" &&9490+
# Generic operators that exist on builtin numeric/container types9491+
# too — `+` is concat on Array/String, arithmetic on Numeric;9492+
# a param using just `+` is no more "user-classy" than `length`.9493+
m != "+" && m != "-" && m != "*" && m != "/" && m != "%" &&9494+
m != "&" && m != "|" && m != "^" && m != "~" &&9495+
m != "<" && m != ">" && m != "<=" && m != ">=" && m != "<=>" &&9496+
m != "===" && m != "!"94889497
return 094899498
end94909499
k = k + 1