diff options
Diffstat (limited to 'crates/syntax')
-rw-r--r-- | crates/syntax/src/ast/make.rs | 3 | ||||
-rw-r--r-- | crates/syntax/src/parsing/text_tree_sink.rs | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 70ba8adb4..05a6b0b25 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs | |||
@@ -222,6 +222,9 @@ pub fn expr_if( | |||
222 | }; | 222 | }; |
223 | expr_from_text(&format!("if {} {} {}", condition, then_branch, else_branch)) | 223 | expr_from_text(&format!("if {} {} {}", condition, then_branch, else_branch)) |
224 | } | 224 | } |
225 | pub fn expr_for_loop(pat: ast::Pat, expr: ast::Expr, block: ast::BlockExpr) -> ast::Expr { | ||
226 | expr_from_text(&format!("for {} in {} {}", pat, expr, block)) | ||
227 | } | ||
225 | pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr { | 228 | pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr { |
226 | let token = token(op); | 229 | let token = token(op); |
227 | expr_from_text(&format!("{}{}", token, expr)) | 230 | expr_from_text(&format!("{}{}", token, expr)) |
diff --git a/crates/syntax/src/parsing/text_tree_sink.rs b/crates/syntax/src/parsing/text_tree_sink.rs index d5ddc076f..bb10f20c9 100644 --- a/crates/syntax/src/parsing/text_tree_sink.rs +++ b/crates/syntax/src/parsing/text_tree_sink.rs | |||
@@ -147,8 +147,8 @@ fn n_attached_trivias<'a>( | |||
147 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, | 147 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, |
148 | ) -> usize { | 148 | ) -> usize { |
149 | match kind { | 149 | match kind { |
150 | MACRO_CALL | MACRO_RULES | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | 150 | MACRO_CALL | MACRO_RULES | CONST | TYPE_ALIAS | STRUCT | UNION | ENUM | VARIANT | FN |
151 | | MODULE | RECORD_FIELD | STATIC | USE => { | 151 | | TRAIT | MODULE | RECORD_FIELD | STATIC | USE => { |
152 | let mut res = 0; | 152 | let mut res = 0; |
153 | let mut trivias = trivias.enumerate().peekable(); | 153 | let mut trivias = trivias.enumerate().peekable(); |
154 | 154 | ||