Look up macro names as well when suggesting replacements for function resolve errors
fixes #5780
This commit is contained in:
@@ -27,7 +27,7 @@ use util::small_vector::SmallVector;
|
||||
use ext::mtwt;
|
||||
use fold::Folder;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
use std::default::Default;
|
||||
|
||||
@@ -856,7 +856,10 @@ pub fn get_exprs_from_tts(cx: &mut ExtCtxt,
|
||||
///
|
||||
/// This environment maps Names to SyntaxExtensions.
|
||||
pub struct SyntaxEnv {
|
||||
chain: Vec<MapChainFrame> ,
|
||||
chain: Vec<MapChainFrame>,
|
||||
/// All bang-style macro/extension names
|
||||
/// encountered so far; to be used for diagnostics in resolve
|
||||
pub names: HashSet<Name>,
|
||||
}
|
||||
|
||||
// impl question: how to implement it? Initially, the
|
||||
@@ -876,7 +879,7 @@ struct MapChainFrame {
|
||||
|
||||
impl SyntaxEnv {
|
||||
fn new() -> SyntaxEnv {
|
||||
let mut map = SyntaxEnv { chain: Vec::new() };
|
||||
let mut map = SyntaxEnv { chain: Vec::new() , names: HashSet::new()};
|
||||
map.push_frame();
|
||||
map
|
||||
}
|
||||
@@ -913,6 +916,9 @@ impl SyntaxEnv {
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, k: Name, v: SyntaxExtension) {
|
||||
if let NormalTT(..) = v {
|
||||
self.names.insert(k);
|
||||
}
|
||||
self.find_escape_frame().map.insert(k, Rc::new(v));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user