Commit 397889d8
397889d88953Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
Merge pull request #602 from ryanseys/rs-double-underscore-send
feat(parse): rewrite .send same as .send
Details
- Commit
- 397889d88953
- Parent
- f5a945b55f00
- Merge parent
- 442d0b4f2363
spinel_parse.cmodifiedView file
@@ -1551,6 +1551,17 @@
15511551
REWRITE_SEND_CALL(".send(\"", 7, 1);15521552
continue;15531553
}1554+
/* .__send__(:foo, args) → .foo(args). CRuby's overrides-resistant1555+
alias of send; semantically identical for Spinel's static dispatch. */1556+
if (i + 11 < len && strncmp(source + i, ".__send__(:", 11) == 0) {1557+
REWRITE_SEND_CALL(".__send__(:", 11, 0);1558+
continue;1559+
}1560+
/* .__send__("foo", args) → .foo(args). String-form variant. */1561+
if (i + 11 < len && strncmp(source + i, ".__send__(\"", 11) == 0) {1562+
REWRITE_SEND_CALL(".__send__(\"", 11, 1);1563+
continue;1564+
}15541565
/* (&:symbol) → { |_spx| _spx.symbol } — also remove enclosing parens */15551566
if (i + 2 < len && source[i] == '&' && source[i + 1] == ':') {15561567
/* Check if preceded by ( and remove it */test/send_double_underscore.rbaddedView file
Loading diff…
test/send_double_underscore.rb.expectedaddedView file
Loading diff…