fix completion bugs

This commit is contained in:
gfreezy 2019-01-23 13:21:29 +08:00
parent 488326ffa7
commit 13d2fd32ab
30 changed files with 179 additions and 135 deletions

View file

@ -143,6 +143,10 @@ impl Module {
return PerNs::none();
}
}
PathKind::Abs => {
// TODO: absolute use is not supported
return PerNs::none();
}
}
.def_id,
);

View file

@ -15,7 +15,8 @@
//! so that the results of name resolution can be preserved unless the module
//! structure itself is modified.
pub(crate) mod lower;
use lower::*;
use crate::nameres::lower::*;
use std::sync::Arc;
@ -59,7 +60,7 @@ impl ModuleScope {
pub struct Resolution {
/// None for unresolved
pub def_id: PerNs<DefId>,
/// ident by whitch this is imported into local scope.
/// ident by which this is imported into local scope.
pub import: Option<ImportId>,
}
@ -317,6 +318,10 @@ where
}
}
PathKind::Crate => module_id.crate_root(&self.module_tree),
PathKind::Abs => {
// TODO: absolute use is not supported for now
return false;
}
};
for (i, segment) in import.path.segments.iter().enumerate() {

View file

@ -38,6 +38,8 @@ pub enum PathKind {
Self_,
Super,
Crate,
// Absolute path
Abs,
}
impl Path {
@ -57,6 +59,11 @@ impl Path {
let mut segments = Vec::new();
loop {
let segment = path.segment()?;
if segment.has_colon_colon() {
kind = PathKind::Abs;
}
match segment.kind()? {
ast::PathSegmentKind::Name(name) => {
let args = segment