Rightward assignment is replaced by one-line pattern matching
This commit is contained in:
parent
c3e2dd072a
commit
700637570f
7
NEWS.md
7
NEWS.md
@ -82,13 +82,6 @@ sufficient information, see the ChangeLog file or Redmine
|
|||||||
class variable from the toplevel scope is now a RuntimeError.
|
class variable from the toplevel scope is now a RuntimeError.
|
||||||
[[Bug #14541]]
|
[[Bug #14541]]
|
||||||
|
|
||||||
* Rightward assignment statement is added. [EXPERIMENTAL]
|
|
||||||
[[Feature #15921]]
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
fib(10) => x
|
|
||||||
```
|
|
||||||
|
|
||||||
* Endless method definition is added. [EXPERIMENTAL]
|
* Endless method definition is added. [EXPERIMENTAL]
|
||||||
[[Feature #16746]]
|
[[Feature #16746]]
|
||||||
|
|
||||||
|
@ -1712,16 +1712,6 @@ eom
|
|||||||
assert_equal [[4, 1, 5, 2, 3], {a: 1}], obj.foo(4, 5, 2, 3, a: 1){|args, kws| [args, kws]}
|
assert_equal [[4, 1, 5, 2, 3], {a: 1}], obj.foo(4, 5, 2, 3, a: 1){|args, kws| [args, kws]}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rightward_assign
|
|
||||||
a = b = nil
|
|
||||||
EnvUtil.suppress_warning {eval("1 => a")}
|
|
||||||
assert_equal(1, a)
|
|
||||||
EnvUtil.suppress_warning {eval("13.divmod(5) => [a,b]")}
|
|
||||||
assert_equal([2,3], [a, b])
|
|
||||||
EnvUtil.suppress_warning {eval("1+2 => a")}
|
|
||||||
assert_equal(3, a)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def not_label(x) @result = x; @not_label ||= nil end
|
def not_label(x) @result = x; @not_label ||= nil end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user