1
Fork 0

Attach TokenStream to ast::Path

This commit is contained in:
Aaron Hill 2020-08-21 18:51:23 -04:00
parent 3815e91ccd
commit 55082ce413
No known key found for this signature in database
GPG key ID: B4087E510E98B164
15 changed files with 41 additions and 21 deletions

View file

@ -794,7 +794,7 @@ impl<'a> Resolver<'a> {
}
segms.push(ast::PathSegment::from_ident(ident));
let path = Path { span: name_binding.span, segments: segms };
let path = Path { span: name_binding.span, segments: segms, tokens: None };
let did = match res {
Res::Def(DefKind::Ctor(..), did) => this.parent(did),
_ => res.opt_def_id(),

View file

@ -1967,7 +1967,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
if qself.is_none() {
let path_seg = |seg: &Segment| PathSegment::from_ident(seg.ident);
let path = Path { segments: path.iter().map(path_seg).collect(), span };
let path = Path { segments: path.iter().map(path_seg).collect(), span, tokens: None };
if let Ok((_, res)) =
self.r.resolve_macro_path(&path, None, &self.parent_scope, false, false)
{

View file

@ -83,6 +83,7 @@ fn import_candidate_to_enum_paths(suggestion: &ImportSuggestion) -> (String, Str
let enum_path = ast::Path {
span: suggestion.path.span,
segments: suggestion.path.segments[0..path_len - 1].to_vec(),
tokens: None,
};
let enum_path_string = path_names_to_string(&enum_path);
@ -1065,7 +1066,8 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
path_segments.push(ast::PathSegment::from_ident(ident));
let module_def_id = module.def_id().unwrap();
if module_def_id == def_id {
let path = Path { span: name_binding.span, segments: path_segments };
let path =
Path { span: name_binding.span, segments: path_segments, tokens: None };
result = Some((
module,
ImportSuggestion {
@ -1095,7 +1097,7 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
if let Res::Def(DefKind::Variant, _) = name_binding.res() {
let mut segms = enum_import_suggestion.path.segments.clone();
segms.push(ast::PathSegment::from_ident(ident));
variants.push(Path { span: name_binding.span, segments: segms });
variants.push(Path { span: name_binding.span, segments: segms, tokens: None });
}
});
variants

View file

@ -3189,6 +3189,7 @@ impl<'a> Resolver<'a> {
.chain(path_str.split("::").skip(1).map(Ident::from_str))
.map(|i| self.new_ast_path_segment(i))
.collect(),
tokens: None,
}
} else {
ast::Path {
@ -3198,6 +3199,7 @@ impl<'a> Resolver<'a> {
.map(Ident::from_str)
.map(|i| self.new_ast_path_segment(i))
.collect(),
tokens: None,
}
};
let module = self.get_module(module_id);