aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-29 07:40:39 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-29 07:40:39 +0100
commit7a1cae59acf72f821343b2ba10ef69fb92a5b952 (patch)
tree26e606ccd132a24e9bc89cf174e4adadf60c5992 /crates/ra_hir/src/expr
parentb0d84cb8faefedde7ace4ff152a2a13408e79e5d (diff)
parent80a17251473bd6213a4c8a51ea7f732394d173c5 (diff)
Merge #1337
1337: Move syntax errors our of syntax tree r=matklad a=matklad I am not really sure if it's a good idea, but `SyntaxError` do not really belong to a `SyntaxTree`. So let's just store them on the side? Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r--crates/ra_hir/src/expr/scope.rs4
-rw-r--r--crates/ra_hir/src/expr/validation.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs
index 58f365128..83d226fc1 100644
--- a/crates/ra_hir/src/expr/scope.rs
+++ b/crates/ra_hir/src/expr/scope.rs
@@ -190,7 +190,7 @@ mod tests {
190 }; 190 };
191 191
192 let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); 192 let (db, _source_root, file_id) = MockDatabase::with_single_file(&code);
193 let file = db.parse(file_id); 193 let file = db.parse(file_id).ok().unwrap();
194 let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); 194 let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap();
195 let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); 195 let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None);
196 196
@@ -288,7 +288,7 @@ mod tests {
288 let (off, code) = extract_offset(code); 288 let (off, code) = extract_offset(code);
289 289
290 let (db, _source_root, file_id) = MockDatabase::with_single_file(&code); 290 let (db, _source_root, file_id) = MockDatabase::with_single_file(&code);
291 let file = db.parse(file_id); 291 let file = db.parse(file_id).ok().unwrap();
292 let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into()) 292 let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into())
293 .expect("failed to find a name at the target offset"); 293 .expect("failed to find a name at the target offset");
294 let name_ref: &ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); 294 let name_ref: &ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap();
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs
index 3f758f283..2816144a7 100644
--- a/crates/ra_hir/src/expr/validation.rs
+++ b/crates/ra_hir/src/expr/validation.rs
@@ -75,7 +75,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
75 } 75 }
76 let source_map = self.func.body_source_map(db); 76 let source_map = self.func.body_source_map(db);
77 let file_id = self.func.source(db).0; 77 let file_id = self.func.source(db).0;
78 let source_file = db.parse(file_id.original_file(db)); 78 let source_file = db.parse(file_id.original_file(db)).tree;
79 if let Some(field_list_node) = source_map 79 if let Some(field_list_node) = source_map
80 .expr_syntax(id) 80 .expr_syntax(id)
81 .map(|ptr| ptr.to_node(source_file.syntax())) 81 .map(|ptr| ptr.to_node(source_file.syntax()))