diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 6 |
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 { | |||
62 | pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr { | 62 | pub 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 | } |
65 | pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr { | ||
66 | let token = token(op); | ||
67 | expr_from_text(&format!("{}{}", token, expr.syntax())) | ||
68 | } | ||
65 | fn expr_from_text(text: &str) -> ast::Expr { | 69 | fn 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 |