Vladyslav Katasonov
271c1cb013
add tests for extracting if/match/while/for exprs
2021-02-05 02:30:34 +03:00
Vladyslav Katasonov
4dc2a42500
document extract_function assist implementation
2021-02-05 02:14:32 +03:00
Vladyslav Katasonov
0ff74467c0
use &T
for non copy params of extracted function
...
Use shared ref if param is not `T: Copy` and is used after body
2021-02-05 01:41:40 +03:00
Vladyslav Katasonov
d9b122858b
split extract_function into pieces and order them
2021-02-05 00:35:28 +03:00
Vladyslav Katasonov
ff77c5e68f
remove ignored test for downgrading mut to shared
2021-02-04 00:52:53 +03:00
Vladyslav Katasonov
c4f3669e70
allow calling &mut
methods on outer vars when extracing function
2021-02-04 00:44:36 +03:00
Vladyslav Katasonov
86ff1d4809
allow &mut param
when extracting function
...
Recognise &mut as variable modification.
This allows extracting functions with
`&mut var` with `var` being in outer scope
2021-02-04 00:27:31 +03:00
Vladyslav Katasonov
f102616aae
allow modifications of vars from outer scope inside extracted function
...
It currently allows only directly setting variable.
No `&mut` references or methods.
2021-02-03 23:45:03 +03:00
Vladyslav Katasonov
82787febde
allow local variables to be used after extracted body
...
when variable is defined inside extracted body
export this variable to original scope via return value(s)
2021-02-03 21:11:12 +03:00
Vladyslav Katasonov
313aa5f3a2
change TODO to FIXME
2021-02-03 17:47:21 +03:00
Vladyslav Katasonov
f0d2bb9131
disable test for downgrading mutability on extract
2021-02-03 17:46:57 +03:00
Vladyslav Katasonov
88b3034636
convert IdentPat to Pat via Into
...
before child getter was used
2021-02-03 17:45:36 +03:00
Vladyslav Katasonov
1e6f13a0be
support extracting methods; no mut lowering
...
currently mut refernce will *not* be downgraded to shared
if it is sufficient(see relevant test for example)
2021-02-03 12:27:53 +03:00
Vladyslav Katasonov
bc3ae81a87
initial version of extract function assist
...
there are a few currently limitations:
* no modifications of function body
* does not handle mutability and references
* no method support
* may produce incorrect results
2021-02-03 10:57:11 +03:00