aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-07 11:07:38 +0000
committerAleksey Kladov <[email protected]>2020-02-07 11:14:33 +0000
commitaa1234e02b1166c57dd2a3cd27fd0b0b3c6cba7e (patch)
treef3f9d08b204ddef33054c06e7eff26dfcf1bb0b3 /crates/ra_syntax/src/ast
parent5aba5a756a19a54d5c4edd51d8055db36182688b (diff)
Generalize invert_if to just always work
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/make.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 02966a3ff..982a7bcdc 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -62,6 +62,10 @@ pub fn expr_return() -> ast::Expr {
62pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr { 62pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr {
63 expr_from_text(&format!("match {} {}", expr.syntax(), match_arm_list.syntax())) 63 expr_from_text(&format!("match {} {}", expr.syntax(), match_arm_list.syntax()))
64} 64}
65pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
66 let token = token(op);
67 expr_from_text(&format!("{}{}", token, expr.syntax()))
68}
65fn expr_from_text(text: &str) -> ast::Expr { 69fn expr_from_text(text: &str) -> ast::Expr {
66 ast_from_text(&format!("const C: () = {};", text)) 70 ast_from_text(&format!("const C: () = {};", text))
67} 71}
@@ -203,7 +207,7 @@ pub mod tokens {
203 use once_cell::sync::Lazy; 207 use once_cell::sync::Lazy;
204 208
205 pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> = 209 pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> =
206 Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2)\n;")); 210 Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;"));
207 211
208 pub fn comma() -> SyntaxToken { 212 pub fn comma() -> SyntaxToken {
209 SOURCE_FILE 213 SOURCE_FILE