aboutsummaryrefslogtreecommitdiff
path: root/crates/ssr/src
Commit message (Collapse)AuthorAgeFilesLines
* ssr: Allow replacing expressions with statementsMarijn Suijten2021-01-042-3/+60
| | | | | | | | | | | | | | | | | Now that statements can be matched and replaced (#6587) some usecases require expressions to be replaced with statements as well. This happens when something that can ambiguously be an expression or statement like `if` and loop blocks appear in the last position of a block, as trailing expression. In this case a replacement pattern of the form `if foo(){$a();}==>>$a();` will only substitute `if` blocks in the list of statements but not if they (implicitly) end up in the trailing expression, where they are not wrapped by an EXPR_STMT (but the pattern and template are, as parsing only succeeds for the `stmt ==>> stmt` case). Instead of adding two rules that match an expression - and emit duplicate matching errors - allow the template for expressions to be a statement if it fails to parse as an expression.
* ssr: Add tests for raw LetStmt matchingMarijn Suijten2021-01-031-0/+44
|
* syntax,ssr: Implement statement parsingMarijn Suijten2021-01-031-0/+1
|
* Remove some unneeded string allocationsLukas Wirth2020-12-311-1/+3
|
* Remove more unreachable pubsAleksey Kladov2020-11-021-1/+1
|
* Re-export base_db from ide_dbIgor Aleksanov2020-10-245-11/+11
|
* Minor clippy performance suggestionskjeremy2020-09-301-1/+1
|
* :arrow_up: ungrammarAleksey Kladov2020-08-212-8/+7
|
* Switch to expect_test from crates.ioAleksey Kladov2020-08-211-1/+1
|
* Future proof find-usages APIAleksey Kladov2020-08-191-1/+1
| | | | | | We might want to provide more efficient impls for check if usages exist, limiting the search, filtering and cancellation, so let's violate YAGNI a bit here.
* Add SelfParam to code_modelAleksey Kladov2020-08-192-2/+2
|
* Merge #5758bors[bot]2020-08-185-38/+245
|\ | | | | | | | | | | | | | | | | | | 5758: SSR: Explicitly autoderef and ref placeholders as needed r=matklad a=davidlattimore Structural search replace now inserts *, & and &mut in the replacement to match any auto[de]ref in the matched code. e.g. `$a.foo() ==>> bar($a)` might convert `x.foo()` to `bar(&mut x)` Co-authored-by: David Lattimore <[email protected]>
| * SSR: A few small refactoringsDavid Lattimore2020-08-182-6/+8
| |
| * SSR: Explicitly autoderef and ref placeholders as neededDavid Lattimore2020-08-144-25/+222
| | | | | | | | Structured search replace now inserts *, & and &mut in the replacement to match any auto[de]ref in the matched code.
| * Refactor SSR so that placeholders store a VarDavid Lattimore2020-08-144-18/+26
| | | | | | | | | | This allows lookup of placeholder bindings given a placeholder without needing to create a Var instance.
* | Rename hypothetical -> speculativeAleksey Kladov2020-08-141-2/+2
|/
* Make hygiene private to hirAleksey Kladov2020-08-131-11/+13
|
* Rename ra_ssr -> ssrAleksey Kladov2020-08-139-0/+3576