aboutsummaryrefslogtreecommitdiff
path: root/crates/ssr/src/tests.rs
Commit message (Collapse)AuthorAgeFilesLines
* ssr: Allow replacing expressions with statementsMarijn Suijten2021-01-041-0/+47
| | | | | | | | | | | | | | | | | 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
|
* Re-export base_db from ide_dbIgor Aleksanov2020-10-241-3/+3
|
* Switch to expect_test from crates.ioAleksey Kladov2020-08-211-1/+1
|
* SSR: A few small refactoringsDavid Lattimore2020-08-181-0/+1
|
* SSR: Explicitly autoderef and ref placeholders as neededDavid Lattimore2020-08-141-0/+106
| | | | 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-141-1/+1
| | | | | This allows lookup of placeholder bindings given a placeholder without needing to create a Var instance.
* Rename ra_ssr -> ssrAleksey Kladov2020-08-131-0/+1174